Skip to content

Commit 0a12aaa

Browse files
committed
Fix signed int overflow in scanner
yylen is unsigned int, but len in zend_scan_escape_string() is int, which will break for string literals >=2GB. yyleng is still limited to 4GB, but we can't fix this without breaking the ABI. Partially addresses GH-19542 Closes GH-19545
1 parent a97717d commit 0a12aaa

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ PHP NEWS
55
- Core:
66
. Fixed bug GH-18850 (Repeated inclusion of file with __halt_compiler()
77
triggers "Constant already defined" warning). (ilutov)
8+
. Partially fixed bug GH-19542 (Scanning of string literals >=2GB will fail
9+
due to signed int overflow). (ilutov)
810

911
- OpenSSL:
1012
. Fixed bug GH-19245 (Success error message on TLS stream accept failure).

Zend/zend_language_scanner.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter
911911
ZVAL_STRINGL(zendlval, yytext, yyleng); \
912912
}
913913

914-
static zend_result zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type)
914+
static zend_result zend_scan_escape_string(zval *zendlval, char *str, size_t len, char quote_type)
915915
{
916916
char *s, *t;
917917
char *end;

0 commit comments

Comments
 (0)