diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-12-22 10:51:39 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-12-22 10:51:39 +0000 |
commit | b08e48166310ab8a53f06f4fee227a948416cf4a (patch) | |
tree | 31a771fc1228216f026f440508fd82300a6bd18c /vcl | |
parent | 2ac9ea00c0a3131fcf520a3f9083da8de79efe01 (diff) |
Resolves: ofz#310: Sanitize 1 bit bitmap palette indexes too
Change-Id: Ied2b71eb1c9088bbbff5fed97f7a04b43f4b4827
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/dibtools.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index 2561b25dcefe..2e85bbca22ee 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -565,6 +565,9 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r { case 1: { + const bool bHasPalette = rAcc.HasPalette(); + const sal_uInt16 nPaletteEntryCount = rAcc.GetPaletteEntryCount(); + for( ; nCount--; nY += nI ) { sal_uInt8 * pTmp = pBuf.get(); @@ -583,7 +586,8 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r cTmp = *pTmp++; } - rAcc.SetPixelIndex( nY, nX, (cTmp >> --nShift) & 1); + auto nIndex = (cTmp >> --nShift) & 1; + rAcc.SetPixelIndex(nY, nX, SanitizePaletteIndex(nIndex, bHasPalette, nPaletteEntryCount)); } } } |