summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-01-24 15:13:49 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-01-24 15:13:49 +0100
commit3c98c2d0cbf476432a4fa6264afc5e43c58fb38f (patch)
treeb22e9e10e1587ef0e3198512781a9c53e02c744e
parentd460e06cb904cd5d9d5412d924cd8690811c97c2 (diff)
downloadphp-git-3c98c2d0cbf476432a4fa6264afc5e43c58fb38f.tar.gz
Fixed bug #77514
-rw-r--r--NEWS7
-rw-r--r--ext/mbstring/php_mbregex.c3
-rw-r--r--ext/mbstring/tests/bug77514.phpt11
3 files changed, 18 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index ca3bcc7f0e..5f32b5a924 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,15 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.3
--Core:
+
+- Core:
. Fixed bug #77494 (Disabling class causes segfault on member access).
(Dmitry)
+- Mbstring:
+ . Fixed bug #77514 (mb_ereg_replace() with trailing backslash adds null byte).
+ (Nikita)
+
- Opcache:
. Fixed bug #77287 (Opcache literal compaction is incompatible with EXT
opcodes). (Nikita)
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index cc96e04f39..319ee567c6 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -713,8 +713,7 @@ static inline void mb_regex_substitute(
sp = p; /* save position */
clen = (int) php_mb_mbchar_bytes_ex(++p, enc);
if (clen != 1 || p == eos) {
- /* skip escaped multibyte char */
- p += clen;
+ /* skip backslash followed by multibyte char */
smart_str_appendl(pbuf, sp, p - sp);
continue;
}
diff --git a/ext/mbstring/tests/bug77514.phpt b/ext/mbstring/tests/bug77514.phpt
new file mode 100644
index 0000000000..efcbea24d7
--- /dev/null
+++ b/ext/mbstring/tests/bug77514.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #77514: mb_ereg_replace() with trailing backslash adds null byte
+--FILE--
+<?php
+
+$a="abc123";
+var_dump(mb_ereg_replace("123","def\\",$a));
+
+?>
+--EXPECT--
+string(7) "abcdef\"