summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-01-30 13:36:01 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-01-30 22:13:10 +0100
commit61364e5b983acea4f8607cc74d8cc6c319a6e3a5 (patch)
tree2f204ca43eecd8fb0b995056c344f17b2ce2f49b /vcl/source
parent8304c06a7b997231962d3a864ce4872cb852c27f (diff)
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 <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/gdi/dibtools.cxx14
1 files changed, 12 insertions, 2 deletions
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);