summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2019-07-29 19:31:47 +0200
committerStanislav Malyshev <stas@php.net>2019-07-29 14:49:33 -0700
commit8947fd9e9fdce87cd6c59817b1db58e789538fe9 (patch)
treeb81edc005e1a3cccee9bc7e1351987730619ef94
parentd69894734d0cc778f9dd7adcd60d9bd27f6af4be (diff)
downloadphp-git-8947fd9e9fdce87cd6c59817b1db58e789538fe9.tar.gz
Fix #78338: Array cross-border reading in PCRE
We backport r1092 from pcre2.
-rw-r--r--ext/pcre/pcre2lib/pcre2_jit_compile.c2
-rw-r--r--ext/pcre/tests/bug78338.phpt10
2 files changed, 11 insertions, 1 deletions
diff --git a/ext/pcre/pcre2lib/pcre2_jit_compile.c b/ext/pcre/pcre2lib/pcre2_jit_compile.c
index e2b08ba22a..c491be2917 100644
--- a/ext/pcre/pcre2lib/pcre2_jit_compile.c
+++ b/ext/pcre/pcre2lib/pcre2_jit_compile.c
@@ -7288,7 +7288,7 @@ int lgb, rgb, ricount;
PCRE2_SPTR bptr;
uint32_t c;
-GETCHARINC(c, cc);
+c = *cc++;
lgb = UCD_GRAPHBREAK(c);
while (cc < end_subject)
diff --git a/ext/pcre/tests/bug78338.phpt b/ext/pcre/tests/bug78338.phpt
new file mode 100644
index 0000000000..ec5bf1b946
--- /dev/null
+++ b/ext/pcre/tests/bug78338.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #78338 (Array cross-border reading in PCRE)
+--FILE--
+<?php
+$string = hex2bin('2f5c583f3d3f223f3536ff3636ffffffff36a8a8a83636367a7a7a7a3d2aff2f0a');
+preg_match($string, $string);
+echo "DONE\n";
+?>
+--EXPECT--
+DONE