Skip to content

Commit

Permalink
Fix bug #77371 (heap buffer overflow in mb regex functions - compile_…
Browse files Browse the repository at this point in the history
…string_node)
  • Loading branch information
smalyshev committed Jan 6, 2019
1 parent deb06bb commit c6e34d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions ext/mbstring/oniguruma/regcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down
10 changes: 10 additions & 0 deletions ext/mbstring/tests/bug77371.phpt
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit c6e34d9

Please sign in to comment.