Skip to content

Commit

Permalink
LZWDecode(): avoid crash when trying to read again from a strip whith…
Browse files Browse the repository at this point in the history
… a missing end-of-information marker (fixes #548)
  • Loading branch information
rouault committed Apr 29, 2023
1 parent 9bd48f0 commit 9be22b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libtiff/tif_lzw.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ static int LZWDecode(TIFF *tif, uint8_t *op0, tmsize_t occ0, uint16_t s)

if (sp->read_error)
{
TIFFErrorExtR(tif, module,
"LZWDecode: Scanline %" PRIu32 " cannot be read due to "
"previous error",
tif->tif_row);
return 0;
}

Expand Down Expand Up @@ -742,6 +746,7 @@ static int LZWDecode(TIFF *tif, uint8_t *op0, tmsize_t occ0, uint16_t s)
return (1);

no_eoi:
sp->read_error = 1;
TIFFErrorExtR(tif, module,
"LZWDecode: Strip %" PRIu32 " not terminated with EOI code",
tif->tif_curstrip);
Expand Down

0 comments on commit 9be22b6

Please sign in to comment.