Fix lexing of zero octal followed by whitespace

We'd call strtol starting at the whitespace, and strtol strips
whitespace...

Fixes oss-fuzz #29272.
This commit is contained in:
Nikita Popov 2021-01-05 12:24:23 +01:00
parent ed4f18b463
commit 0067c3ced1
2 changed files with 13 additions and 0 deletions

View file

@ -0,0 +1,8 @@
--TEST--
Octal literal followed by whitespace and another number
--FILE--
<?php
var_dump(0o0 2);
?>
--EXPECTF--
Parse error: syntax error, unexpected integer "2", expecting ")" in %s on line %d

View file

@ -1963,6 +1963,11 @@ NEWLINE ("\r"|"\n"|"\r\n")
--len;
}
if (len == 0) {
ZVAL_LONG(zendlval, 0);
RETURN_TOKEN_WITH_VAL(T_LNUMBER);
}
if (contains_underscores) {
octal = estrndup(octal, len);
strip_underscores(octal, &len);