Bug #78454 [Opn->Ana]: Multiple consecutive numeric separators in bin/hex numbers cause fatal error
| From: | requinix@php.net | Date: | Sat, 24 Aug 2019 22:55:49 +0000 |
| Subject: | Bug #78454 [Opn->Ana]: Multiple consecutive numeric separators in bin/hex numbers cause fatal error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222396@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78454&edit=1
ID: 78454
Updated by: requinix@php.net
Reported by: mattacosta at gmail dot com
-Summary: Multiple numeric separators in bin/hex numbers cause
fatal error
+Summary: Multiple consecutive numeric separators in bin/hex
numbers cause fatal error
-Status: Open
+Status: Analyzed
Type: Bug
Package: Scripting Engine problem
PHP Version: 7.4.0beta4
Block user comment: N
Private report: N
New Comment:
> Fatal error: Possible integer overflow in memory allocation (0 + 32)
1. Multiple consecutive underscores are not supposed to be allowed
2. Parser is matching HNUM as only the "0x0"
3. HNUM code skips *all* leading zeros and underscores, goes beyond "0x0" length assumed,
len underflows
Previous Comments:
------------------------------------------------------------------------
[2019-08-24 22:05:13] mattacosta at gmail dot com
Description:
------------
Multiple adjacent underscores after a leading 0 in a hex or bin number cause a fatal error.
https://3v4l.org/jUR51
Test script:
---------------
0x0__F; // or 0b0__1;
Expected result:
----------------
Parse error: syntax error, unexpected '__F' (T_STRING)
Actual result:
--------------
Fatal error: Out of memory (allocated 2097152) (tried to allocate 18446744073709551615 bytes) in
/in/jUR51 on line 3
mmap() failed: [22] Invalid argument
mmap() failed: [22] Invalid argument
Process exited with code 255.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78454&edit=1