Incorrect error code checking in TiffDecode.c

* since Pillow 8.1.0
* CVE-2021-25289
This commit is contained in:
Eric Soroos 2021-01-03 21:35:32 +01:00 committed by Andrew Murray
parent e5839216a5
commit 3fee28eb94
4 changed files with 3 additions and 2 deletions

View File

@ -24,6 +24,8 @@ from .helper import on_ci
"Tests/images/crash_1.tif",
"Tests/images/crash_2.tif",
"Tests/images/crash-2020-10-test.tif",
"Tests/images/crash-1152ec2d1a1a71395b6f2ce6721c38924d025bf3.tif",
"Tests/images/crash-0e16d3bfb83be87356d026d66919deaefca44dac.tif",
],
)
@pytest.mark.filterwarnings("ignore:Possibly corrupt EXIF data")

View File

@ -282,8 +282,7 @@ _decodeStripYCbCr(Imaging im, ImagingCodecState state, TIFF *tiff) {
img.row_offset = state->y;
rows_to_read = min(rows_per_strip, img.height - state->y);
if (TIFFRGBAImageGet(&img, (UINT32 *)state->buffer, img.width, rows_to_read) ==
-1) {
if (!TIFFRGBAImageGet(&img, (UINT32 *)state->buffer, img.width, rows_to_read)) {
TRACE(("Decode Error, y: %d\n", state->y));
state->errcode = IMAGING_CODEC_BROKEN;
goto decodeycbcr_err;