Skip to content

Commit

Permalink
Another improvement of calculating the size of the extent.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Apr 5, 2023
1 parent 2da5520 commit 49ccd7e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions coders/tiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1814,15 +1814,14 @@ static Image *ReadTIFFImage(const ImageInfo *image_info,
*/
strip_size=TIFFStripSize(tiff);
stride=(ssize_t) TIFFVStripSize(tiff,1);
extent=(size_t) ((samples_per_pixel+extra_samples)*strip_size);
length=GetQuantumExtent(image,quantum_info,quantum_type);
if (length > stride)
extent+=length;
extent=MagickMax((size_t) strip_size,rows_per_strip*
(size_t) MagickMax(stride,length));
strip_pixels=(unsigned char *) AcquireQuantumMemory(extent,
sizeof(uint32));
sizeof(*strip_pixels));
if (strip_pixels == (unsigned char *) NULL)
ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed");
(void) memset(strip_pixels,0,extent*sizeof(uint32));
(void) memset(strip_pixels,0,extent*sizeof(*strip_pixels));
strip_id=0;
p=strip_pixels;
for (i=0; i < (ssize_t) samples_per_pixel; i++)
Expand Down

0 comments on commit 49ccd7e

Please sign in to comment.