mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix GH-16184: UBSan address overflowed in ext/pcre/php_pcre.c
This commit is contained in:
commit
ddc7a6b1fc
3 changed files with 21 additions and 4 deletions
4
NEWS
4
NEWS
|
@ -40,7 +40,9 @@ PHP NEWS
|
||||||
. Fixed stub for openssl_csr_new. (Jakub Zelenka)
|
. Fixed stub for openssl_csr_new. (Jakub Zelenka)
|
||||||
|
|
||||||
- PCRE:
|
- PCRE:
|
||||||
. Fixed GH-16189 (underflow on offset argument). (David Carlier)
|
. Fixed bug GH-16189 (underflow on offset argument). (David Carlier)
|
||||||
|
. Fixed bug GH-16184 (UBSan address overflowed in ext/pcre/php_pcre.c).
|
||||||
|
(nielsdos)
|
||||||
|
|
||||||
- PHPDBG:
|
- PHPDBG:
|
||||||
. Fixed bug GH-15901 (phpdbg: Assertion failure on i funcs). (cmb)
|
. Fixed bug GH-15901 (phpdbg: Assertion failure on i funcs). (cmb)
|
||||||
|
|
|
@ -1728,10 +1728,12 @@ matched:
|
||||||
}
|
}
|
||||||
if (preg_get_backref(&walk, &backref)) {
|
if (preg_get_backref(&walk, &backref)) {
|
||||||
if (backref < count) {
|
if (backref < count) {
|
||||||
|
if (offsets[backref<<1] < SIZE_MAX) {
|
||||||
match_len = offsets[(backref<<1)+1] - offsets[backref<<1];
|
match_len = offsets[(backref<<1)+1] - offsets[backref<<1];
|
||||||
memcpy(walkbuf, subject + offsets[backref<<1], match_len);
|
memcpy(walkbuf, subject + offsets[backref<<1], match_len);
|
||||||
walkbuf += match_len;
|
walkbuf += match_len;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
ext/pcre/tests/gh16184.phpt
Normal file
13
ext/pcre/tests/gh16184.phpt
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
--TEST--
|
||||||
|
GH-16184 (UBSan address overflowed in ext/pcre/php_pcre.c)
|
||||||
|
--CREDITS--
|
||||||
|
YuanchengJiang
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$string = 'This is a string. It contains numbers (0*9) as well as parentheses and some other things!';
|
||||||
|
echo preg_replace(array('/\b\w{1}s/', '/(\d{1})*(\d{1})/', '/[\(!\)]/'), array('test', '$1 to $2', '*'), $string), "\n";
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
This test a string. It contains numbers * to 0* to 9* test well test parentheses and some other things*
|
Loading…
Add table
Add a link
Reference in a new issue