diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-09-28 09:35:23 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-28 12:32:37 +0000 |
commit | 6f8a09eef9abbf250798122f2c22e35adac1b90d (patch) | |
tree | c231d56af81383e1b61a6f6b7af430f03afc3c9a | |
parent | c08aba2fb93ce31b3a0b2f93e8717804e861d311 (diff) |
wmf spec says that these are only allowed bitcount values
Change-Id: Ia174feec73ee676567a3632d2f88b11c176b6363
(cherry picked from commit b107353addfe35cc40864b7fb5ff4fee42fff6cf)
Reviewed-on: https://gerrit.libreoffice.org/18903
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | vcl/qa/cppunit/graphicfilter/data/wmf/fail/bitcount-1.wmf | bin | 0 -> 1916 bytes | |||
-rw-r--r-- | vcl/source/gdi/dibtools.cxx | 14 |
2 files changed, 13 insertions, 1 deletions
diff --git a/vcl/qa/cppunit/graphicfilter/data/wmf/fail/bitcount-1.wmf b/vcl/qa/cppunit/graphicfilter/data/wmf/fail/bitcount-1.wmf Binary files differnew file mode 100644 index 000000000000..2ec88066f527 --- /dev/null +++ b/vcl/qa/cppunit/graphicfilter/data/wmf/fail/bitcount-1.wmf diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index 247ce7c9378a..a018bebcb7c5 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -276,7 +276,19 @@ bool ImplReadDIBInfoHeader(SvStream& rIStm, DIBV5Header& rHeader, bool& bTopDown rHeader.nSizeImage = 0; } - return( ( rHeader.nPlanes == 1 ) && ( rIStm.GetError() == 0UL ) ); + + if (rHeader.nPlanes != 1) + return false; + + if (rHeader.nBitCount != 0 && rHeader.nBitCount != 1 && + rHeader.nBitCount != 4 && rHeader.nBitCount != 8 && + rHeader.nBitCount != 16 && rHeader.nBitCount != 24 && + rHeader.nBitCount != 32) + { + return false; + } + + return rIStm.good(); } bool ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, bool bQuad ) |