ofz#47673 skip oversized tiff images

Change-Id: I78727819b7c440855f89240f396dad845a295d61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135041
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2022-05-27 14:14:06 +01:00
parent 9ae3863f2a
commit 8c4ca609c5

View file

@ -136,8 +136,14 @@ bool ImportTiffGraphicImport(SvStream& rTIFF, Graphic& rGraphic)
}
}
size_t npixels = w * h;
std::vector<uint32_t> raster(npixels);
uint32_t nPixelsRequired;
if (o3tl::checked_multiply(w, h, nPixelsRequired))
{
SAL_WARN("filter.tiff", "skipping oversized tiff image");
break;
}
std::vector<uint32_t> raster(nPixelsRequired);
if (TIFFReadRGBAImageOriented(tif, w, h, raster.data(), ORIENTATION_TOPLEFT, 1))
{
Bitmap bitmap(Size(w, h), vcl::PixelFormat::N24_BPP);