1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 10:16:41 +02:00

Fix #78633: Heap buffer overflow (read) in mb_eregi

We backport kkos/oniguruma@15c4228aa2.
This commit is contained in:
Christoph M. Becker
2019-10-04 19:02:37 +02:00
committed by Stanislav Malyshev
parent ce035dc4a0
commit 4f50d58cab
3 changed files with 15 additions and 1 deletions
+1 -1
View File
@@ -724,8 +724,8 @@ add_compile_string(UChar* s, int mb_len, int str_len,
COP(reg)->exact_n.s = p;
}
else {
xmemset(COP(reg)->exact.s, 0, sizeof(COP(reg)->exact.s));
xmemcpy(COP(reg)->exact.s, s, (size_t )byte_len);
COP(reg)->exact.s[byte_len] = '\0';
}
return 0;
+1
View File
@@ -2900,6 +2900,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
DATA_ENSURE(0);
q = lowbuf;
while (len-- > 0) {
if (ps >= endp) goto fail;
if (*ps != *q) goto fail;
ps++; q++;
}
+13
View File
@@ -0,0 +1,13 @@
--TEST--
Bug #78633 (Heap buffer overflow (read) in mb_eregi)
--SKIPIF--
<?php
if (!extension_loaded('mbstring')) die('skip mbstring extension not available');
if (!function_exists('mb_eregi')) die('skip mb_eregi function not available');
?>
--FILE--
<?php
var_dump(mb_eregi(".+Isssǰ", ".+Isssǰ"));
?>
--EXPECT--
bool(false)