Skip to content

Commit

Permalink
Incorrect error code checking in TiffDecode.c
Browse files Browse the repository at this point in the history
* since Pillow 8.1.0
* CVE-2021-25289
  • Loading branch information
wiredfool authored and radarhere committed Mar 1, 2021
1 parent 2ba5eb1 commit cbfdde7
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 1 deletion.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions Tests/test_tiff_crashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"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")
Expand Down
2 changes: 1 addition & 1 deletion src/libImaging/TiffDecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ int _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;
Expand Down

0 comments on commit cbfdde7

Please sign in to comment.