com php-src: Fix #78454: Consecutive numeric separators cause OOM error: NEWS Zend/tests/bug78454_1.phpt Zend/tests/bu g78454_2.phpt
Zend/zend_language_scanner .l

From: Date: Sun, 25 Aug 2019 20:46:18 +0000
Subject: com php-src: Fix #78454: Consecutive numeric separators cause OOM error: NEWS Zend/tests/bug78454_1.phpt Zend/tests/bu g78454_2.phpt
Zend/zend_language_scanner .l
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-108041@lists.php.net to get a copy of this message
Commit: 1a78bdab276a9e34aa1ae00a184538e2d0dacdcd Author: Theodore Brown <theodorejb@outlook.com> Sun, 25 Aug 2019 00:33:51 -0500 Committer: Christoph M. Becker <cmbecker69@gmx.de> Sun, 25 Aug 2019 22:46:18 +0200 Parents: ac40d0ffbca2a8c941c748ace7528b4699b307fc Branches: PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1a78bdab276a9e34aa1ae00a184538e2d0dacdcd Log: Fix #78454: Consecutive numeric separators cause OOM error Resolves out of memory error when consecutive numeric separators follow a binary/hex literal. Bugs: https://bugs.php.net/78454 Changed paths: M NEWS A Zend/tests/bug78454_1.phpt A Zend/tests/bug78454_2.phpt M Zend/zend_language_scanner.l Diff: diff --git a/NEWS b/NEWS index 45df257..69913fd 100644 --- a/NEWS +++ b/NEWS @@ -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). diff --git a/Zend/tests/bug78454_1.phpt b/Zend/tests/bug78454_1.phpt new file mode 100644 index 0000000..184d358 --- /dev/null +++ b/Zend/tests/bug78454_1.phpt @@ -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 diff --git a/Zend/tests/bug78454_2.phpt b/Zend/tests/bug78454_2.phpt new file mode 100644 index 0000000..b67b839 --- /dev/null +++ b/Zend/tests/bug78454_2.phpt @@ -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 diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 2e21ee7..84ed669 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -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; }

« previous php.cvs (#108041) next »