1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 16:38:25 +02:00

Fix #78454: Consecutive numeric separators cause OOM error

Resolves out of memory error when consecutive numeric separators follow a binary/hex literal.
This commit is contained in:
Theodore Brown
2019-08-25 00:33:51 -05:00
committed by Christoph M. Becker
parent ac40d0ffbc
commit 1a78bdab27
4 changed files with 18 additions and 2 deletions
+2
View File
@@ -9,6 +9,8 @@ PHP NEWS
(cmb, Nikita)
. Fixed bug #78441 (Parse error due to heredoc identifier followed by digit).
(cmb)
. Fixed bug #78454 (Consecutive numeric separators cause OOM error).
(Theodore Brown)
- SPL:
. Fixed bug #78436 (Missing addref in SplPriorityQueue EXTR_BOTH mode).
+7
View File
@@ -0,0 +1,7 @@
--TEST--
Invalid consecutive numeric separators after hex literal
--FILE--
<?php
0x0__F;
--EXPECTF--
Parse error: syntax error, unexpected '__F' (T_STRING) in %s on line %d
+7
View File
@@ -0,0 +1,7 @@
--TEST--
Invalid consecutive numeric separators after binary literal
--FILE--
<?php
0b0__1
--EXPECTF--
Parse error: syntax error, unexpected '__1' (T_STRING) in %s on line %d
+2 -2
View File
@@ -1775,7 +1775,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
char *end, *bin = yytext + 2;
/* Skip any leading 0s */
while (*bin == '0' || *bin == '_') {
while (len > 0 && (*bin == '0' || *bin == '_')) {
++bin;
--len;
}
@@ -1892,7 +1892,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
char *end, *hex = yytext + 2;
/* Skip any leading 0s */
while (*hex == '0' || *hex == '_') {
while (len > 0 && (*hex == '0' || *hex == '_')) {
++hex;
--len;
}