vcl/source/gdi/dibtools.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
New commits: commit 61364e5b983acea4f8607cc74d8cc6c319a6e3a5 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Jan 30 13:36:01 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Jan 30 22:13:10 2019 +0100 Resolves: tdf#122958 bmps with weird compression values that work in mso Change-Id: Ie1887288cba7c1d56b807dbc9ddb886b9d20ff33 Reviewed-on: https://gerrit.libreoffice.org/67143 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/qa/cppunit/graphicfilter/data/wmf/fail/CVE-2015-0848-1.wmf b/vcl/qa/cppunit/graphicfilter/data/wmf/pass/CVE-2015-0848-1.wmf similarity index 100% rename from vcl/qa/cppunit/graphicfilter/data/wmf/fail/CVE-2015-0848-1.wmf rename to vcl/qa/cppunit/graphicfilter/data/wmf/pass/CVE-2015-0848-1.wmf diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index f78cbc02c03a..fd7bb4306076 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -942,6 +942,18 @@ bool ImplReadDIBBody(SvStream& rIStm, Bitmap& rBmp, AlphaMask* pBmpAlpha, sal_uL return false; break; } + default: + // tdf#122958 invalid compression value used + if (aHeader.nCompression & 0x000F) + { + // lets assume that there was an error in the generating application + // and allow through as COMPRESS_NONE if the bottom byte is 0 + SAL_WARN( "vcl", "bad bmp compression scheme: " << aHeader.nCompression << ", rejecting bmp"); + return false; + } + else + SAL_WARN( "vcl", "bad bmp compression scheme: " << aHeader.nCompression << ", assuming meant to be COMPRESS_NONE"); + [[fallthrough]]; case BITFIELDS: case ZCOMPRESS: case COMPRESS_NONE: @@ -953,8 +965,6 @@ bool ImplReadDIBBody(SvStream& rIStm, Bitmap& rBmp, AlphaMask* pBmpAlpha, sal_uL return false; break; } - default: - return false; } const Size aSizePixel(aHeader.nWidth, aHeader.nHeight); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits