1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00

Fix bug #77371 (heap buffer overflow in mb regex functions - compile_string_node)

This commit is contained in:
Stanislav Malyshev
2018-12-29 20:06:08 -08:00
parent 20407d06ca
commit 28362ed4fa
2 changed files with 11 additions and 0 deletions

View File

@@ -524,6 +524,7 @@ compile_string_node(Node* node, regex_t* reg)
for (; p < end; ) {
len = enclen(enc, p);
if (p + len > end) len = end - p;
if (len == prev_len) {
slen++;
}

View File

@@ -0,0 +1,10 @@
--TEST--
Bug #77371 (heap buffer overflow in mb regex functions - compile_string_node)
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--FILE--
<?php
var_dump(mb_ereg("()0\xfc00000\xfc00000\xfc00000\xfc",""))
?>
--EXPECT--
bool(false)