1
0
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:
Ilija Tovilo
2023-12-12 21:58:34 +01:00
committed by GitHub
parent 0917a3636e
commit be46545ee0
2 changed files with 12 additions and 1 deletions

View File

@@ -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;

View 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)