Skip to content

Commit 5447473

Browse files
committed
Partially fix GH-17387
The length of the string should be set to the truncated length (that was used to duplicate the input anyway).
1 parent 333f5dd commit 5447473

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ PHP NEWS
99
. Fixed bug GH-17623 (Broken stack overflow detection for variable
1010
compilation). (ilutov)
1111

12+
- PHPDBG:
13+
. Partially fixed bug GH-17387 (Trivial crash in phpdbg lexer). (nielsdos)
14+
1215
13 Feb 2025, PHP 8.3.17
1316

1417
- Core:

sapi/phpdbg/phpdbg_lexer.l

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@ INPUT ("\\"[#"']|["]("\\\\"|"\\"["]|[^\n\000"])*["]|[']("\\"[']|"\\\\"|[^\
160160
161161
<NORMAL>{GENERIC_ID} {
162162
phpdbg_init_param(yylval, STR_PARAM);
163-
yylval->str = estrndup(yytext, yyleng - unescape_string(yytext));
164-
yylval->len = yyleng;
163+
size_t len = yyleng - unescape_string(yytext);
164+
yylval->str = estrndup(yytext, len);
165+
yylval->len = len;
165166
return T_ID;
166167
}
167168

0 commit comments

Comments
 (0)