mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
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:
parent
ed4f18b463
commit
0067c3ced1
2 changed files with 13 additions and 0 deletions
8
Zend/tests/oct_whitespace.phpt
Normal file
8
Zend/tests/oct_whitespace.phpt
Normal 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
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue