Merge branch 'PHP-7.1' into PHP-7.2

* PHP-7.1:
  Fix bug #77988 - heap-buffer-overflow on php_jpg_get16
This commit is contained in:
Stanislav Malyshev 2019-05-27 17:28:20 -07:00
commit dc1d99e772
3 changed files with 13 additions and 0 deletions

View File

@ -3947,6 +3947,8 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
if (c == 0xFF)
return FALSE;
marker = c;
if (pos>=ImageInfo->Thumbnail.size)
return FALSE;
length = php_jpg_get16(data+pos);
if (length > ImageInfo->Thumbnail.size || pos >= ImageInfo->Thumbnail.size - length) {
return FALSE;

BIN
ext/exif/tests/bug77988.jpg Normal file

Binary file not shown.

View File

@ -0,0 +1,11 @@
--TEST--
Bug #77988 (heap-buffer-overflow on php_jpg_get16)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
exif_read_data(__DIR__."/bug77988.jpg", 'COMMENT', FALSE, TRUE);
?>
DONE
--EXPECTF--
DONE