com php-src: Merge branch 'PHP-7.2' into PHP-7.3: ext/exif/exif.c ext/exif/tests/bug77950.phpt ext/exif/tests/bug77950.tiff
| From: | Christoph Michael Becker | Date: | Tue, 30 Apr 2019 07:57:44 +0000 |
| Subject: | com php-src: Merge branch 'PHP-7.2' into PHP-7.3: ext/exif/exif.c ext/exif/tests/bug77950.phpt ext/exif/tests/bug77950.tiff | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106001@lists.php.net to get a copy of this message | ||
Commit: 6484774161f30571fc1b3a67b3c06f2d43f16ca8
Author: Stanislav Malyshev <stas@php.net> Tue, 30 Apr 2019 00:05:43 -0700
Committer: Christoph M. Becker <cmbecker69@gmx.de> Tue, 30 Apr 2019 09:57:44 +0200
Parents: e0b907d0a4cd5b42aefb03c2a6917bd8a29f8abc
Branches: PHP-7.3.5
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6484774161f30571fc1b3a67b3c06f2d43f16ca8
Log:
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
(cherry picked from commit 66b32f25d56147bbd8fc4733959389d30f6621af)
Bugs:
https://bugs.php.net/77950
Changed paths:
M ext/exif/exif.c
A ext/exif/tests/bug77950..phpt
A ext/exif/tests/bug77950.tiff
Diff:
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index f6419b7..78269b9 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 0000000..dc0f354
--- /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
new file mode 100644
index 0000000..5c8250a
Binary files /dev/null and b/ext/exif/tests/bug77950.tiff differ