Kaydet (Commit) 2a118816 authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz#827 avoid oom in xpms

Change-Id: I323be5e042e0ccb21956def70a8c481833f43998
üst 127b2e59
...@@ -160,6 +160,10 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic ) ...@@ -160,6 +160,10 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic )
mbStatus = false; mbStatus = false;
if ( ( mnWidth * mnCpp ) >= XPMSTRINGBUF ) if ( ( mnWidth * mnCpp ) >= XPMSTRINGBUF )
mbStatus = false; mbStatus = false;
//xpms are a minimum of one character (one byte) per pixel, so if the file isn't
//even that long, its not all there
if (mrIStm.remainingSize() < static_cast<sal_uInt64>(mnWidth) * mnHeight)
mbStatus = false;
if ( mbStatus && mnWidth && mnHeight && mnColors && mnCpp ) if ( mbStatus && mnWidth && mnHeight && mnColors && mnCpp )
{ {
mnIdentifier = XPMCOLORS; mnIdentifier = XPMCOLORS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment