From 70c6a6f624ec07be37ce90424d0765e3c78d1bf5 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Sun, 26 Jul 2015 22:57:12 +0200 Subject: Fix infinite lexer loop for :\ sequence in phpdbg --- sapi/phpdbg/phpdbg_lexer.l | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'sapi/phpdbg/phpdbg_lexer.l') diff --git a/sapi/phpdbg/phpdbg_lexer.l b/sapi/phpdbg/phpdbg_lexer.l index 7fca70f57a..35ca744400 100644 --- a/sapi/phpdbg/phpdbg_lexer.l +++ b/sapi/phpdbg/phpdbg_lexer.l @@ -60,6 +60,7 @@ T_RUN_SHORT "r" WS [ \r\n\t]+ DIGITS [-]?[0-9\.]+ ID [^ \r\n\t:#\000]+ +GENERIC_ID ([^ \r\n\t:#\000]|":\\")+ ADDR [0][x][a-fA-F0-9]+ OPCODE (ZEND_|zend_)([A-Za-z])+ INPUT [^\n\000]+ @@ -70,7 +71,7 @@ INPUT [^\n\000]+ return 0; } -[-][r]{WS}?{DIGITS} { +"-r"{WS}?{DIGITS} { char *text = yytext + 2; while (*++text < '0'); yylval->num = atoi(text); @@ -83,22 +84,23 @@ INPUT [^\n\000]+ return T_IF; } -{ID}[:]{1}[//]{2} { - phpdbg_init_param(yylval, STR_PARAM); - yylval->str = zend_strndup(yytext, yyleng); - yylval->len = yyleng; - return T_PROTO; -} -[#]{1} { +"#" { return T_POUND; } -[:]{2} { +"::" { return T_DCOLON; } -[:]{1}/[^\\] { +":"/[^\\] { return T_COLON; } +{ID}"://" { + phpdbg_init_param(yylval, STR_PARAM); + yylval->str = zend_strndup(yytext, yyleng); + yylval->len = yyleng; + return T_PROTO; +} + ({T_YES}|{T_ON}|{T_ENABLED}|{T_TRUE}){WS} { phpdbg_init_param(yylval, NUMERIC_PARAM); yylval->num = 1; @@ -130,7 +132,7 @@ INPUT [^\n\000]+ return T_OPCODE; } -{ID} { +{GENERIC_ID} { phpdbg_init_param(yylval, STR_PARAM); yylval->str = zend_strndup(yytext, yyleng); yylval->len = yyleng; -- cgit v1.2.1