Skip to content

Commit 666833b

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix #76813: Access violation near NULL on source operand
2 parents d5a82e2 + 5e15c9c commit 666833b

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

NEWS

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ PHP NEWS
2727
. Fixed bug #80368 (OpenSSL extension fails to build against LibreSSL due to
2828
lack of OCB support). (Nikita)
2929

30+
- Phpdbg:
31+
. Fixed bug #76813 (Access violation near NULL on source operand). (cmb)
32+
3033
- Standard:
3134
. Fixed bug #80366 (Return Value of zend_fstat() not Checked). (sagpant, cmb)
3235

sapi/phpdbg/phpdbg_lexer.l

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void phpdbg_init_lexer (phpdbg_param_t *stack, char *input) {
3333

3434
YYSETCONDITION(INITIAL);
3535

36-
LEX(text) = YYCURSOR = (unsigned char *) input;
36+
LEX(text) = YYCURSOR = YYMARKER = (unsigned char *) input;
3737
LEX(len) = strlen(input);
3838
}
3939

@@ -165,6 +165,10 @@ INPUT ("\\"[#"']|["]("\\\\"|"\\"["]|[^\n\000"])+["]|[']("\\"[']|"\\\\"|[^\
165165
return T_ID;
166166
}
167167
168+
<NORMAL>* {
169+
return T_UNEXPECTED;
170+
}
171+
168172
<RAW>{INPUT} {
169173
phpdbg_init_param(yylval, STR_PARAM);
170174
yylval->str = estrdup(yytext);

sapi/phpdbg/phpdbg_parser.y

+6-2
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,15 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg)
6363
%% /* Rules */
6464

6565
input
66-
: command { $$ = $1; }
67-
| input T_SEPARATOR command { phpdbg_stack_separate($1.top); $$ = $3; }
66+
: non_empty_input { $$ = $1; }
6867
| %empty
6968
;
7069

70+
non_empty_input
71+
: command { $$ = $1; }
72+
| non_empty_input T_SEPARATOR command { phpdbg_stack_separate($1.top); $$ = $3; }
73+
;
74+
7175
command
7276
: parameters { $$.top = PHPDBG_G(parser_stack)->top; }
7377
| full_expression { phpdbg_stack_push(PHPDBG_G(parser_stack), &$1); $$.top = PHPDBG_G(parser_stack)->top; }

sapi/phpdbg/tests/bug76813.phpt

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Bug #76813 (Access_violation_near_NULL_on_source_operand)
3+
--PHPDBG--
4+
"#!==)===\377\377\276\242="
5+
#!==)===\377\377\276\242=
6+
--EXPECT--
7+
prompt> [Parse Error: syntax error, unexpected input, expecting $end]
8+
prompt> [Parse Error: syntax error, unexpected # (pound sign), expecting $end]
9+
prompt> [Parse Error: syntax error, unexpected # (pound sign), expecting $end]
10+
prompt>

0 commit comments

Comments
 (0)