From 664f8e13736b610c091c7f3855f655158b09333a Mon Sep 17 00:00:00 2001 From: Li Zhou Date: Fri, 21 Feb 2020 17:15:31 +0800 Subject: php: Security Advisory - php - CVE-2020-7059 Backport the patch to solve CVE-2020-7059. Because of the version context, this porting mainly refers to the version merging commit Signed-off-by: Li Zhou Signed-off-by: Khem Raj --- .../recipes-devtools/php/php/CVE-2020-7059.patch | 86 ++++++++++++++++++++++ meta-oe/recipes-devtools/php/php_7.3.11.bb | 1 + 2 files changed, 87 insertions(+) create mode 100644 meta-oe/recipes-devtools/php/php/CVE-2020-7059.patch (limited to 'meta-oe/recipes-devtools/php') diff --git a/meta-oe/recipes-devtools/php/php/CVE-2020-7059.patch b/meta-oe/recipes-devtools/php/php/CVE-2020-7059.patch new file mode 100644 index 0000000000..f7d3ab6b66 --- /dev/null +++ b/meta-oe/recipes-devtools/php/php/CVE-2020-7059.patch @@ -0,0 +1,86 @@ +From 1adaab3aa81fa9b48e351b5644d9fee70f2fe73f Mon Sep 17 00:00:00 2001 +From: Li Zhou +Date: Thu, 20 Feb 2020 02:05:52 -0800 +Subject: [PATCH] Fix #79099: OOB read in php_strip_tags_ex + +Upstream-Status: Backport +CVE: CVE-2020-7059 +Signed-off-by: Li Zhou +--- + ext/standard/string.c | 6 +++--- + ext/standard/tests/file/bug79099.phpt | 32 ++++++++++++++++++++++++++++++++ + 2 files changed, 35 insertions(+), 3 deletions(-) + create mode 100644 ext/standard/tests/file/bug79099.phpt + +diff --git a/ext/standard/string.c b/ext/standard/string.c +index dde97fa..2213d8d 100644 +--- a/ext/standard/string.c ++++ b/ext/standard/string.c +@@ -5163,7 +5163,7 @@ state_1: + } + + lc = '>'; +- if (is_xml && *(p -1) == '-') { ++ if (is_xml && p >= buf + 1 && *(p -1) == '-') { + break; + } + in_q = state = is_xml = 0; +@@ -5195,7 +5195,7 @@ state_1: + goto reg_char_1; + case '!': + /* JavaScript & Other HTML scripting languages */ +- if (*(p-1) == '<') { ++ if (p >= buf + 1 && *(p-1) == '<') { + state = 3; + lc = c; + p++; +@@ -5205,7 +5205,7 @@ state_1: + } + break; + case '?': +- if (*(p-1) == '<') { ++ if (p >= buf + 1 && *(p-1) == '<') { + br=0; + state = 2; + p++; +diff --git a/ext/standard/tests/file/bug79099.phpt b/ext/standard/tests/file/bug79099.phpt +new file mode 100644 +index 0000000..a1f2a33 +--- /dev/null ++++ b/ext/standard/tests/file/bug79099.phpt +@@ -0,0 +1,32 @@ ++--TEST-- ++Bug #79099 (OOB read in php_strip_tags_ex) ++--FILE-- ++ ++--EXPECT-- ++string(0) "" ++string(0) "" ++string(0) "" ++string(0) "" ++string(0) "" ++string(0) "" +-- +1.9.1 + diff --git a/meta-oe/recipes-devtools/php/php_7.3.11.bb b/meta-oe/recipes-devtools/php/php_7.3.11.bb index 0e76cbf75c..8dbaf8922c 100644 --- a/meta-oe/recipes-devtools/php/php_7.3.11.bb +++ b/meta-oe/recipes-devtools/php/php_7.3.11.bb @@ -18,6 +18,7 @@ SRC_URI = "http://php.net/distributions/php-${PV}.tar.bz2 \ file://0001-Use-pkg-config-for-libxml2-detection.patch \ file://debian-php-fixheader.patch \ file://CVE-2019-6978.patch \ + file://CVE-2020-7059.patch \ " SRC_URI_append_class-target = " \ -- cgit 1.2.3-korg