Skip to content

Commit

Permalink
fix stack overflow when parsing malicious tiff image
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Oct 19, 2021
1 parent 18e15da commit f620340
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
https://github.com/ImageMagick/ImageMagick/issues/4372).
* fix possible unitialized values (reference
https://github.com/ImageMagick/ImageMagick/issues/4379).
* fix stack overflow when parsing malicious tiff image file (report from
Muhammad Aldo Firmansyah).

2021-10-10 7.1.0-10 <quetzlzacatenango@image...>
* Release ImageMagick version 7.1.0-10 GIT revision 19236:07ebe6b6e:20211010
Expand Down
5 changes: 5 additions & 0 deletions coders/tiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -2001,6 +2001,11 @@ static Image *ReadTIFFImage(const ImageInfo *image_info,
if (HeapOverflowSanityCheck(rows,sizeof(*tile_pixels)) != MagickFalse)
ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed");
extent=MagickMax(rows*TIFFTileRowSize(tiff),TIFFTileSize(tiff));
#if defined(TIFF_VERSION_BIG)
extent+=image->columns*sizeof(uint64);
#else
extent+=image->columns*sizeof(uint32);
#endif
tile_pixels=(unsigned char *) AcquireQuantumMemory(extent,
sizeof(*tile_pixels));
if (tile_pixels == (unsigned char *) NULL)
Expand Down

0 comments on commit f620340

Please sign in to comment.