Skip to content

Commit 5702ce6

Browse files
committed
Merge branch 'PHP-7.4'
2 parents c9ab107 + f5d2a30 commit 5702ce6

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

ext/mbstring/php_mbregex.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,11 @@ PHP_FUNCTION(mb_split)
12281228
count--;
12291229
}
12301230

1231+
if (!php_mb_check_encoding(string, string_len,
1232+
_php_mb_regex_mbctype2name(MBREX(current_mbctype)))) {
1233+
RETURN_FALSE;
1234+
}
1235+
12311236
/* create regex pattern buffer */
12321237
if ((re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, MBREX(regex_default_options), MBREX(current_mbctype), MBREX(regex_default_syntax))) == NULL) {
12331238
RETURN_FALSE;
@@ -1317,6 +1322,11 @@ PHP_FUNCTION(mb_ereg_match)
13171322
}
13181323
}
13191324

1325+
if (!php_mb_check_encoding(string, string_len,
1326+
_php_mb_regex_mbctype2name(MBREX(current_mbctype)))) {
1327+
RETURN_FALSE;
1328+
}
1329+
13201330
if ((re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, option, MBREX(current_mbctype), syntax)) == NULL) {
13211331
RETURN_FALSE;
13221332
}

ext/mbstring/tests/bug77367.phpt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,5 @@ if (!function_exists('mb_split')) die('mb_split() not available');
1010
mb_regex_encoding('UTF-8');
1111
var_dump(mb_split("\\w", "\xfc"));
1212
?>
13-
===DONE===
1413
--EXPECT--
15-
array(2) {
16-
[0]=>
17-
string(0) ""
18-
[1]=>
19-
string(0) ""
20-
}
21-
===DONE===
14+
bool(false)

ext/mbstring/tests/bug77418.phpt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Bug #77371 (Heap overflow in utf32be_mbc_to_code)
2+
Bug #77418 (Heap overflow in utf32be_mbc_to_code)
33
--SKIPIF--
44
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
55
--FILE--
@@ -8,7 +8,4 @@ mb_regex_encoding("UTF-32");
88
var_dump(mb_split("\x00\x00\x00\x5c\x00\x00\x00B","000000000000000000000000000000"));
99
?>
1010
--EXPECT--
11-
array(1) {
12-
[0]=>
13-
string(30) "000000000000000000000000000000"
14-
}
11+
bool(false)

0 commit comments

Comments
 (0)