Skip to content

Commit 9c90114

Browse files
committed
exif/heic: Prevent overflow when computing meta bounds
1 parent 518c2a8 commit 9c90114

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/exif/exif.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4416,7 +4416,8 @@ static bool exif_scan_HEIF_header(image_info_type *ImageInfo, unsigned char *buf
44164416
exif_isobmff_parse_meta(data, data + limit, &pos);
44174417
}
44184418
if ((pos.size) &&
4419-
(ImageInfo->FileSize >= pos.offset + pos.size) &&
4419+
(pos.size < ImageInfo->FileSize) &&
4420+
(ImageInfo->FileSize - pos.size >= pos.offset) &&
44204421
(php_stream_seek(ImageInfo->infile, pos.offset + 2, SEEK_SET) >= 0)) {
44214422
if (limit >= pos.size - 2) {
44224423
limit = pos.size - 2;

0 commit comments

Comments
 (0)