Created
July 29, 2019 17:32
-
-
Save cmb69/3878eb568ea5d894f765a2703e5693e2 to your computer and use it in GitHub Desktop.
Fix PHP bug #78338
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d3309a786e3d7da7b393a0ec37aacb7b7677bd50 Mon Sep 17 00:00:00 2001 | |
From: "Christoph M. Becker" <cmbecker69@gmx.de> | |
Date: Mon, 29 Jul 2019 19:31:47 +0200 | |
Subject: [PATCH] Fix #78338: Array cross-border reading in PCRE | |
We backport r1092 from pcre2. | |
--- | |
ext/pcre/pcre2lib/pcre2_jit_compile.c | 2 +- | |
ext/pcre/tests/bug78338.phpt | 10 ++++++++++ | |
2 files changed, 11 insertions(+), 1 deletion(-) | |
create mode 100644 ext/pcre/tests/bug78338.phpt | |
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 | |
-- | |
2.22.0.windows.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment