summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-09-28 09:35:23 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-09-28 12:27:50 +0000
commitf86ff1a0c164649b06d4721e659c500b0855b79d (patch)
tree6c3f6103cdc0bebc3998d307c32d6ece1fa8cde9 /vcl
parent23be91deb8858bb29793ae8cc9749cf1e5c3c9b2 (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/18902 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qa/cppunit/graphicfilter/data/wmf/fail/bitcount-1.wmfbin0 -> 1916 bytes
-rw-r--r--vcl/source/gdi/dibtools.cxx14
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
new file mode 100644
index 000000000000..2ec88066f527
--- /dev/null
+++ b/vcl/qa/cppunit/graphicfilter/data/wmf/fail/bitcount-1.wmf
Binary files differ
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 4267cce75d7d..509d2e45f573 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -267,7 +267,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 )