diff options
-rw-r--r-- | meta-oe/recipes-devtools/php/php/CVE-2020-7059.patch | 86 | ||||
-rw-r--r-- | meta-oe/recipes-devtools/php/php_7.3.11.bb | 1 |
2 files changed, 87 insertions, 0 deletions
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 @@ | |||
1 | From 1adaab3aa81fa9b48e351b5644d9fee70f2fe73f Mon Sep 17 00:00:00 2001 | ||
2 | From: Li Zhou <li.zhou@windriver.com> | ||
3 | Date: Thu, 20 Feb 2020 02:05:52 -0800 | ||
4 | Subject: [PATCH] Fix #79099: OOB read in php_strip_tags_ex | ||
5 | |||
6 | Upstream-Status: Backport | ||
7 | CVE: CVE-2020-7059 | ||
8 | Signed-off-by: Li Zhou <li.zhou@windriver.com> | ||
9 | --- | ||
10 | ext/standard/string.c | 6 +++--- | ||
11 | ext/standard/tests/file/bug79099.phpt | 32 ++++++++++++++++++++++++++++++++ | ||
12 | 2 files changed, 35 insertions(+), 3 deletions(-) | ||
13 | create mode 100644 ext/standard/tests/file/bug79099.phpt | ||
14 | |||
15 | diff --git a/ext/standard/string.c b/ext/standard/string.c | ||
16 | index dde97fa..2213d8d 100644 | ||
17 | --- a/ext/standard/string.c | ||
18 | +++ b/ext/standard/string.c | ||
19 | @@ -5163,7 +5163,7 @@ state_1: | ||
20 | } | ||
21 | |||
22 | lc = '>'; | ||
23 | - if (is_xml && *(p -1) == '-') { | ||
24 | + if (is_xml && p >= buf + 1 && *(p -1) == '-') { | ||
25 | break; | ||
26 | } | ||
27 | in_q = state = is_xml = 0; | ||
28 | @@ -5195,7 +5195,7 @@ state_1: | ||
29 | goto reg_char_1; | ||
30 | case '!': | ||
31 | /* JavaScript & Other HTML scripting languages */ | ||
32 | - if (*(p-1) == '<') { | ||
33 | + if (p >= buf + 1 && *(p-1) == '<') { | ||
34 | state = 3; | ||
35 | lc = c; | ||
36 | p++; | ||
37 | @@ -5205,7 +5205,7 @@ state_1: | ||
38 | } | ||
39 | break; | ||
40 | case '?': | ||
41 | - if (*(p-1) == '<') { | ||
42 | + if (p >= buf + 1 && *(p-1) == '<') { | ||
43 | br=0; | ||
44 | state = 2; | ||
45 | p++; | ||
46 | diff --git a/ext/standard/tests/file/bug79099.phpt b/ext/standard/tests/file/bug79099.phpt | ||
47 | new file mode 100644 | ||
48 | index 0000000..a1f2a33 | ||
49 | --- /dev/null | ||
50 | +++ b/ext/standard/tests/file/bug79099.phpt | ||
51 | @@ -0,0 +1,32 @@ | ||
52 | +--TEST-- | ||
53 | +Bug #79099 (OOB read in php_strip_tags_ex) | ||
54 | +--FILE-- | ||
55 | +<?php | ||
56 | +$stream = fopen('php://memory', 'w+'); | ||
57 | +fputs($stream, "<?\n\"\n"); | ||
58 | +rewind($stream); | ||
59 | +var_dump(@fgetss($stream)); | ||
60 | +var_dump(@fgetss($stream)); | ||
61 | +fclose($stream); | ||
62 | + | ||
63 | +$stream = fopen('php://memory', 'w+'); | ||
64 | +fputs($stream, "<\0\n!\n"); | ||
65 | +rewind($stream); | ||
66 | +var_dump(@fgetss($stream)); | ||
67 | +var_dump(@fgetss($stream)); | ||
68 | +fclose($stream); | ||
69 | + | ||
70 | +$stream = fopen('php://memory', 'w+'); | ||
71 | +fputs($stream, "<\0\n?\n"); | ||
72 | +rewind($stream); | ||
73 | +var_dump(@fgetss($stream)); | ||
74 | +var_dump(@fgetss($stream)); | ||
75 | +fclose($stream); | ||
76 | +?> | ||
77 | +--EXPECT-- | ||
78 | +string(0) "" | ||
79 | +string(0) "" | ||
80 | +string(0) "" | ||
81 | +string(0) "" | ||
82 | +string(0) "" | ||
83 | +string(0) "" | ||
84 | -- | ||
85 | 1.9.1 | ||
86 | |||
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 \ | |||
18 | file://0001-Use-pkg-config-for-libxml2-detection.patch \ | 18 | file://0001-Use-pkg-config-for-libxml2-detection.patch \ |
19 | file://debian-php-fixheader.patch \ | 19 | file://debian-php-fixheader.patch \ |
20 | file://CVE-2019-6978.patch \ | 20 | file://CVE-2019-6978.patch \ |
21 | file://CVE-2020-7059.patch \ | ||
21 | " | 22 | " |
22 | 23 | ||
23 | SRC_URI_append_class-target = " \ | 24 | SRC_URI_append_class-target = " \ |