From 4d57671f3bdd9628cd21d0991e50a96b10abf63a Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Thu, 10 Apr 2014 08:47:58 +0000 Subject: 124639: correct consideration of not provided header offset when checking certain read header data --- vcl/source/gdi/dibtools.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'vcl/source') diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index d4ea127f5c06..503ccf902d5c 100755 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -615,12 +615,15 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon { DIBV5Header aHeader; const sal_uLong nStmPos = rIStm.Tell(); - bool bRet(false); - bool bTopDown(false); + bool bRet( false ); + bool bTopDown( false ); - if(ImplReadDIBInfoHeader(rIStm, aHeader, bTopDown) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount) + if ( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown ) + && aHeader.nWidth != 0 + && aHeader.nHeight != 0 + && aHeader.nBitCount != 0 ) { - if (aHeader.nSize > nOffset) + if ( nOffset > 0 && aHeader.nSize > nOffset ) { // Header size claims to extend into the image data. // Looks like an error. -- cgit