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:
@@ -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++;
|
||||
}
|
||||
|
||||
10
ext/mbstring/tests/bug77371.phpt
Normal file
10
ext/mbstring/tests/bug77371.phpt
Normal 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)
|
||||
Reference in New Issue
Block a user