[Libreoffice-commits] core.git: vcl/source
Caolán McNamara
caolanm at redhat.com
Thu Dec 22 10:52:18 UTC 2016
vcl/source/gdi/dibtools.cxx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit b08e48166310ab8a53f06f4fee227a948416cf4a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Dec 22 10:51:39 2016 +0000
Resolves: ofz#310: Sanitize 1 bit bitmap palette indexes too
Change-Id: Ied2b71eb1c9088bbbff5fed97f7a04b43f4b4827
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 2561b25..2e85bbc 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));
}
}
}
More information about the Libreoffice-commits
mailing list