Skip to content

Commit dd84447

Browse files
author
Cristy
committed
Prevent buffer overflow (bug report from Ibrahim el-sayed)
1 parent ae87d4d commit dd84447

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: MagickCore/property.c

+5
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,11 @@ static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,
665665
if ((count & 0x01) == 0)
666666
(void) ReadPropertyByte(&info,&length);
667667
count=(ssize_t) ReadPropertyMSBLong(&info,&length);
668+
if ((count < 0) || ((size_t) count > length))
669+
{
670+
length=0;
671+
continue;
672+
}
668673
if ((*name != '\0') && (*name != '#'))
669674
if ((resource == (char *) NULL) || (LocaleCompare(name,resource) != 0))
670675
{

0 commit comments

Comments
 (0)