Kaydet (Commit) 4e1161c6 authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz#6315 Heap-buffer-overflow

Change-Id: Ia611f65b9fb38f125c224473e584580eeff20622
Reviewed-on: https://gerrit.libreoffice.org/49716Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst fe0f548f
...@@ -584,6 +584,7 @@ bool TIFFReader::ReadMap() ...@@ -584,6 +584,7 @@ bool TIFFReader::ReadMap()
aCCIDecom.StartDecompression( *pTIFF ); aCCIDecom.StartDecompression( *pTIFF );
const bool bHasAlphaChannel = HasAlphaChannel();
for (sal_Int32 ny = 0; ny < nImageLength; ++ny) for (sal_Int32 ny = 0; ny < nImageLength; ++ny)
{ {
bool bDifferentToPrev = ny == 0; bool bDifferentToPrev = ny == 0;
...@@ -617,9 +618,10 @@ bool TIFFReader::ReadMap() ...@@ -617,9 +618,10 @@ bool TIFFReader::ReadMap()
//if the buffer for this line didn't change, then just copy the //if the buffer for this line didn't change, then just copy the
//previous scanline instead of painfully decoding and setting //previous scanline instead of painfully decoding and setting
//each pixel one by one again //each pixel one by one again
memcpy( mpBitmap.get() + (ny * maBitmapPixelSize.Width()) * 4, const int nColorSize = bHasAlphaChannel ? 4 : 3;
mpBitmap.get() + ((ny-1) * maBitmapPixelSize.Width()) * 4, memcpy( mpBitmap.get() + (ny * maBitmapPixelSize.Width()) * nColorSize,
maBitmapPixelSize.Width() * 4); mpBitmap.get() + ((ny-1) * maBitmapPixelSize.Width()) * nColorSize,
maBitmapPixelSize.Width() * nColorSize);
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment