diff options
author | Stanislav Malyshev <stas@php.net> | 2019-04-30 00:05:43 -0700 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2019-04-30 00:05:43 -0700 |
commit | 66b32f25d56147bbd8fc4733959389d30f6621af (patch) | |
tree | f77b5e8dc3b18a006f64d396c5569238a90cbe75 | |
parent | 506a764089ba82457345b334bfb0b8d80727ae2f (diff) | |
parent | cb5af4e8a0f028237cfd2c99e395cef39f097ca9 (diff) | |
download | php-git-66b32f25d56147bbd8fc4733959389d30f6621af.tar.gz |
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
Fix bug #77950 - Heap-buffer-overflow in _estrndup via exif_process_IFD_TAG
-rw-r--r-- | ext/exif/exif.c | 2 | ||||
-rw-r--r-- | ext/exif/tests/bug77950.phpt | 12 | ||||
-rw-r--r-- | ext/exif/tests/bug77950.tiff | bin | 0 -> 1267 bytes |
3 files changed, 13 insertions, 1 deletions
diff --git a/ext/exif/exif.c b/ext/exif/exif.c index f6419b7038..78269b9a92 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -3277,7 +3277,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha offset_base is ImageInfo->file.list[sn].data-dir_offset dir_entry - offset_base is dir_offset+2+i*12 */ - if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base)) { + if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry || offset_val < (size_t)(dir_entry-offset_base) || dir_entry <= offset_base) { /* It is important to check for IMAGE_FILETYPE_TIFF * JPEG does not use absolute pointers instead its pointers are * relative to the start of the TIFF header in APP1 section. */ diff --git a/ext/exif/tests/bug77950.phpt b/ext/exif/tests/bug77950.phpt new file mode 100644 index 0000000000..dc0f3549cb --- /dev/null +++ b/ext/exif/tests/bug77950.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #77950 (Heap-buffer-overflow in _estrndup via exif_process_IFD_TAG) +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--FILE-- +<?php +exif_read_data(__DIR__."/bug77950.tiff"); +?> +DONE +--EXPECTF-- +%A +DONE
\ No newline at end of file diff --git a/ext/exif/tests/bug77950.tiff b/ext/exif/tests/bug77950.tiff Binary files differnew file mode 100644 index 0000000000..5c8250ab04 --- /dev/null +++ b/ext/exif/tests/bug77950.tiff |