diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-06-09 17:08:51 +0300 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-06-09 17:08:51 +0300 |
commit | 6a1af670d52492ab0955933b830026b2a18ed6d6 (patch) | |
tree | 14e423ab81da7312ac0f800aaa6afce7e23abc20 /src/3rdparty/libtiff/libtiff/tif_ojpeg.c | |
parent | e57b0df609d744c3ddb2d3f23926a7922e661cb6 (diff) | |
parent | 8fb9a4fdcb05984bb6e9e532e4462aa7bfbeb62e (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.11' into tqtc/lts-5.15-opensourcev5.15.11-lts-lgpl
Change-Id: I1ef7b4328096b0adb6abc46471100b5779504d05
Diffstat (limited to 'src/3rdparty/libtiff/libtiff/tif_ojpeg.c')
-rw-r--r-- | src/3rdparty/libtiff/libtiff/tif_ojpeg.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/3rdparty/libtiff/libtiff/tif_ojpeg.c b/src/3rdparty/libtiff/libtiff/tif_ojpeg.c index 66cd275..d682395 100644 --- a/src/3rdparty/libtiff/libtiff/tif_ojpeg.c +++ b/src/3rdparty/libtiff/libtiff/tif_ojpeg.c @@ -795,6 +795,17 @@ OJPEGDecode(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s) TIFFErrorExt(tif->tif_clientdata,module,"Cannot decode: decoder not correctly initialized"); return 0; } + if( sp->libjpeg_session_active == 0 ) + { + /* This should normally not happen, except that it does when */ + /* using TIFFReadScanline() which calls OJPEGPostDecode() for */ + /* each scanline, which assumes that a whole strile was read */ + /* and may thus incorrectly consider it has read the whole image, causing */ + /* OJPEGLibjpegSessionAbort() to be called prematurely. */ + /* Triggered by https://gitlab.com/libtiff/libtiff/-/issues/337 */ + TIFFErrorExt(tif->tif_clientdata,module,"Cannot decode: libjpeg_session_active == 0"); + return 0; + } if( sp->error_in_raw_data_decoding ) { return 0; @@ -901,6 +912,13 @@ OJPEGPostDecode(TIFF* tif, uint8_t* buf, tmsize_t cc) OJPEGState* sp=(OJPEGState*)tif->tif_data; (void)buf; (void)cc; + /* This function somehow incorrectly assumes that a whole strile was read, */ + /* which is not true when TIFFReadScanline() is called, */ + /* and may thus incorrectly consider it has read the whole image, causing */ + /* OJPEGLibjpegSessionAbort() to be called prematurely. */ + /* So this logic should be fixed to take into account cc, or disable */ + /* the scan line reading interface. */ + /* Triggered by https://gitlab.com/libtiff/libtiff/-/issues/337 */ sp->write_curstrile++; if (sp->write_curstrile%tif->tif_dir.td_stripsperimage==0) { |