diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-08-06 19:45:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-08-07 11:24:06 +0200 |
commit | d384da42a0f710040fffcf12120e8f81e99ac56a (patch) | |
tree | 94bd3c060f9540a0f4f9aa431d222594366827a5 | |
parent | b430cc2c3fba0ef2e56a1eb8610681c66714ef80 (diff) |
ofz: Use-of-uninitialized-value
For tdf#149417 we generally allow one short read for fidelity with the
old parser that this replaced. But don't allow that for new format
variations that the old parser didn't handle so we don't take libtiff
into uncharted territory.
Change-Id: I8d2d6954257a63a56d201eaed6510fcc38f9a5ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155384
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r-- | vcl/source/filter/itiff/itiff.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/vcl/source/filter/itiff/itiff.cxx b/vcl/source/filter/itiff/itiff.cxx index bdbf0309e296..39bc51a00860 100644 --- a/vcl/source/filter/itiff/itiff.cxx +++ b/vcl/source/filter/itiff/itiff.cxx @@ -222,7 +222,16 @@ bool ImportTiffGraphicImport(SvStream& rTIFF, Graphic& rGraphic) break; std::vector<uint32_t> raster(nPixelsRequired); - aContext.bAllowOneShortRead = true; + + uint16_t compression(COMPRESSION_NONE); + const bool bNewCodec = TIFFGetField(tif, TIFFTAG_COMPRESSION, &compression) == 1 && + compression >= COMPRESSION_ZSTD; // >= 50000 at time of writing + // For tdf#149417 we generally allow one short read for fidelity with the old + // parser that this replaced. But don't allow that for new format variations + // that the old parser didn't handle so we don't take libtiff into uncharted + // territory. + aContext.bAllowOneShortRead = !bNewCodec; + if (TIFFReadRGBAImageOriented(tif, w, h, raster.data(), ORIENTATION_TOPLEFT, 1)) { Bitmap bitmap(Size(w, h), vcl::PixelFormat::N24_BPP); |