From 73ce1409877bd5dd18289e69915ccb835b1ca4bf Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 30 Apr 2019 13:12:51 +0200 Subject: - exif: Fix #77950 Heap-buffer-overflow in _estrndup via exif_process_IFD_TAG CVE-2019-11036 --- failed.txt | 4 +--- php-bug77950.patch | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ php.spec | 11 ++++++++- 3 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 php-bug77950.patch diff --git a/failed.txt b/failed.txt index 7c2375b..e455e82 100644 --- a/failed.txt +++ b/failed.txt @@ -1,12 +1,10 @@ -===== 7.0.33-7 (2019-04-02) +===== 7.0.33-8 (2019-04-30) $ grep -r 'Tests failed' /var/lib/mock/scl70*/build.log /var/lib/mock/scl70el6x/build.log:Tests failed : 0 /var/lib/mock/scl70el7x/build.log:Tests failed : 0 /var/lib/mock/scl70el8x/build.log:Tests failed : 28 -/var/lib/mock/scl70fc25x/build.log:Tests failed : 0 -/var/lib/mock/scl70fc26x/build.log:Tests failed : 0 /var/lib/mock/scl70fc27x/build.log:Tests failed : 0 /var/lib/mock/scl70fc28x/build.log:Tests failed : 0 /var/lib/mock/scl70fc29x/build.log:Tests failed : 1 diff --git a/php-bug77950.patch b/php-bug77950.patch new file mode 100644 index 0000000..c075368 --- /dev/null +++ b/php-bug77950.patch @@ -0,0 +1,65 @@ +Without test as binary patch not supported + + + + +From 8c12f5a635fb4fc5f485bc4f884aea5c7b37f6b0 Mon Sep 17 00:00:00 2001 +From: Stanislav Malyshev +Date: Mon, 29 Apr 2019 23:38:12 -0700 +Subject: [PATCH] Fix bug #77950 - Heap-buffer-overflow in _estrndup via + exif_process_IFD_TAG + +I do not completely understand what is going on there, but I am pretty +sure dir_entry <= offset_base if not a normal situation, so we better not +to rely on such dir_entry. + +(cherry picked from commit f80ad18afae2230c2c1802c7d829100af646874e) +--- + NEWS | 12 ++++++++++-- + ext/exif/exif.c | 2 +- + ext/exif/tests/bug77950.phpt | 12 ++++++++++++ + ext/exif/tests/bug77950.tiff | Bin 0 -> 1267 bytes + 4 files changed, 23 insertions(+), 3 deletions(-) + create mode 100644 ext/exif/tests/bug77950.phpt + create mode 100644 ext/exif/tests/bug77950.tiff + +diff --git a/NEWS b/NEWS +index a49afe2411..f26a3ad10e 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,11 +1,19 @@ + PHP NEWS + ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| + ++Backported from 7.1.29 ++ ++- EXIF ++ . Fixed bug #77950 (Heap-buffer-overflow in _estrndup via exif_process_IFD_TAG). ++ (CVE-2019-11036) (Stas) ++ + Backported from 7.1.28 + + - EXIF: +- . Fixed bug #77753 (Heap-buffer-overflow in php_ifd_get32s). (Stas) +- . Fixed bug #77831 (Heap-buffer-overflow in exif_iif_add_value). (Stas) ++ . Fixed bug #77753 (Heap-buffer-overflow in php_ifd_get32s). (CVE-2019-11034) ++ (Stas) ++ . Fixed bug #77831 (Heap-buffer-overflow in exif_iif_add_value). ++ (CVE-2019-11035) (Stas) + + - SQLite3: + . Added sqlite3.defensive INI directive. (BohwaZ) +diff --git a/ext/exif/exif.c b/ext/exif/exif.c +index 0e490abd1b..a9df95d554 100644 +--- a/ext/exif/exif.c ++++ b/ext/exif/exif.c +@@ -2890,7 +2890,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/php.spec b/php.spec index 7d251a2..c8813b9 100644 --- a/php.spec +++ b/php.spec @@ -131,7 +131,7 @@ Summary: PHP scripting language for creating dynamic web sites Name: %{?scl_prefix}php Version: %{upver}%{?rcver:~%{rcver}} -Release: 7%{?dist} +Release: 8%{?dist} # All files licensed under PHP version 3.01, except # Zend is licensed under Zend # TSRM is licensed under BSD @@ -214,6 +214,7 @@ Patch214: php-news.patch Patch215: php-sqlite3-defensive.patch Patch216: php-bug77753.patch Patch217: php-bug77831.patch +Patch218: php-bug77950.patch # Fixes for tests (300+) # Factory is droped from system tzdata @@ -972,6 +973,7 @@ support for JavaScript Object Notation (JSON) to PHP. %patch215 -p1 -b .sqlite3.defensive %patch216 -p1 -b .bug77753 %patch217 -p1 -b .bug77831 +%patch218 -p1 -b .bug77950 : --------------------------- #exit 1 @@ -1927,10 +1929,17 @@ EOF %changelog +* Tue Apr 30 2019 Remi Collet - 7.0.33-8 +- exif: + Fix #77950 Heap-buffer-overflow in _estrndup via exif_process_IFD_TAG + CVE-2019-11036 + * Tue Apr 2 2019 Remi Collet - 7.0.33-7 - exif: Fix #77753 Heap-buffer-overflow in php_ifd_get32s + CVE-2019-11034 Fix #77831 Heap-buffer-overflow in exif_iif_add_value + CVE-2019-11035 - sqlite3: Added sqlite3.defensive INI directive -- cgit