diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-03-12 21:06:23 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-03-12 21:07:42 +0000 |
commit | 2a118816d90e8daa36a447db7cf4718830450099 (patch) | |
tree | a4692bf1f0feb13db376227fd46179a735b2ceb9 /vcl | |
parent | 127b2e59995f3abcf1593138cd27af9f375d7b1b (diff) |
ofz#827 avoid oom in xpms
Change-Id: I323be5e042e0ccb21956def70a8c481833f43998
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/ixpm/xpmread.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx index 6d348ebb47b2..19b3fd4a05cf 100644 --- a/vcl/source/filter/ixpm/xpmread.cxx +++ b/vcl/source/filter/ixpm/xpmread.cxx @@ -160,6 +160,10 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic ) mbStatus = false; if ( ( mnWidth * mnCpp ) >= XPMSTRINGBUF ) 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 ) { mnIdentifier = XPMCOLORS; |