From d4873496e8c74192f50f061cd8ab512e706a44ad Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 14 Mar 2017 21:23:12 +0000 Subject: return early on clearly broken xbms Change-Id: Ic94a75aacb6bcd47d594a12e0df999a58b04b061 --- vcl/source/filter/ixbm/xbmread.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'vcl') diff --git a/vcl/source/filter/ixbm/xbmread.cxx b/vcl/source/filter/ixbm/xbmread.cxx index 38475fdb0273..d3d21c4229c7 100644 --- a/vcl/source/filter/ixbm/xbmread.cxx +++ b/vcl/source/filter/ixbm/xbmread.cxx @@ -308,6 +308,11 @@ ReadState XBMReader::ReadXBM( Graphic& rGraphic ) else bStatus = false; + //xbms are a minimum of one character per 8 pixels, so if the file isn't + //even that long, its not all there + if (rIStm.remainingSize() < (static_cast(nWidth) * nHeight) / 8) + bStatus = false; + if ( bStatus && nWidth && nHeight ) { aBmp1 = Bitmap( Size( nWidth, nHeight ), 1 ); -- cgit