Skip to content

Commit dc1d99e

Browse files
committed
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fix bug #77988 - heap-buffer-overflow on php_jpg_get16
2 parents 9bca9ef + 73ff419 commit dc1d99e

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

ext/exif/exif.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3947,6 +3947,8 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
39473947
if (c == 0xFF)
39483948
return FALSE;
39493949
marker = c;
3950+
if (pos>=ImageInfo->Thumbnail.size)
3951+
return FALSE;
39503952
length = php_jpg_get16(data+pos);
39513953
if (length > ImageInfo->Thumbnail.size || pos >= ImageInfo->Thumbnail.size - length) {
39523954
return FALSE;

ext/exif/tests/bug77988.jpg

1.17 KB
Loading

ext/exif/tests/bug77988.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Bug #77988 (heap-buffer-overflow on php_jpg_get16)
3+
--SKIPIF--
4+
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
5+
--FILE--
6+
<?php
7+
exif_read_data(__DIR__."/bug77988.jpg", 'COMMENT', FALSE, TRUE);
8+
?>
9+
DONE
10+
--EXPECTF--
11+
DONE

0 commit comments

Comments
 (0)