mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix pcre out-of-bounds when using closing symbols as opening delimiter (#12946)
Apparently we support using closing symbols )]}> as opening and closing delimiters. Fixes oss-fuzz #65021
This commit is contained in:
@@ -655,7 +655,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, bo
|
||||
}
|
||||
|
||||
start_delimiter = delimiter;
|
||||
if ((pp = strchr("([{< )]}>", delimiter)))
|
||||
if ((pp = strchr("([{< )]}> )]}>", delimiter)))
|
||||
delimiter = pp[5];
|
||||
end_delimiter = delimiter;
|
||||
|
||||
|
||||
11
ext/pcre/tests/oss-fuzz-65021.phpt
Normal file
11
ext/pcre/tests/oss-fuzz-65021.phpt
Normal file
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
oss-fuzz #65021
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(preg_match(">",""));
|
||||
var_dump(preg_match(">foo>i","FOO"));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: preg_match(): No ending delimiter '>' found in %s on line %d
|
||||
bool(false)
|
||||
int(1)
|
||||
Reference in New Issue
Block a user