Skip to content

Commit

Permalink
check the image list length
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Aug 6, 2023
1 parent 0d70d19 commit 4bec491
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions coders/xcf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1431,9 +1431,8 @@ static Image *ReadXCFImage(const ImageInfo *image_info,ExceptionInfo *exception)
else
{
number_layers++;
if ((ssize_t) number_layers == SSIZE_MAX)
ThrowReaderException(ResourceLimitError,
"ListLengthExceedsLimit");
if (AcquireMagickResource(ListLengthResource,number_layers) == MagickFalse)
ThrowReaderException(ResourceLimitError,"ListLengthExceedsLimit");
}
if (EOFBlob(image) != MagickFalse)
{
Expand All @@ -1442,8 +1441,6 @@ static Image *ReadXCFImage(const ImageInfo *image_info,ExceptionInfo *exception)
break;
}
} while (foundAllLayers == MagickFalse);
if (AcquireMagickResource(ListLengthResource,number_layers) == MagickFalse)
ThrowReaderException(ResourceLimitError,"ListLengthExceedsLimit");
doc_info.number_layers=number_layers;
offset=SeekBlob(image,oldPos,SEEK_SET); /* restore the position! */
if (offset < 0)
Expand Down

0 comments on commit 4bec491

Please sign in to comment.