From e03e143177178f4d41e36a90e6306785002987c4 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 20 Dec 2014 09:48:18 +0100 Subject: [PATCH] Report error for invalid escape sequences fixes #7910 --- lib/config/config_lexer.ll | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/config/config_lexer.ll b/lib/config/config_lexer.ll index a32163fdd..15efe4b10 100644 --- a/lib/config/config_lexer.ll +++ b/lib/config/config_lexer.ll @@ -89,7 +89,7 @@ do { \ if (result > 0xff) { /* error, constant is out-of-bounds */ - BOOST_THROW_EXCEPTION(ScriptError("Constant is out of bounds: " + String(yytext), DebugInfoRange(yyextra->m_LocationBegin, *yylloc))); + BOOST_THROW_EXCEPTION(ScriptError("Constant is out of bounds: " + String(yytext), *yylloc)); } yyextra->m_LexBuffer << static_cast(result); @@ -99,7 +99,7 @@ do { \ /* generate error - bad escape sequence; something * like '\48' or '\0777777' */ - BOOST_THROW_EXCEPTION(ScriptError("Bad escape sequence found: " + String(yytext), DebugInfoRange(yyextra->m_LocationBegin, *yylloc))); + BOOST_THROW_EXCEPTION(ScriptError("Bad escape sequence found: " + String(yytext), *yylloc)); } \\n { yyextra->m_LexBuffer << "\n"; } @@ -107,7 +107,10 @@ do { \ \\r { yyextra->m_LexBuffer << "\r"; } \\b { yyextra->m_LexBuffer << "\b"; } \\f { yyextra->m_LexBuffer << "\f"; } -\\(.|\n) { yyextra->m_LexBuffer << yytext[1]; } +\\\n { yyextra->m_LexBuffer << yytext[1]; } +\\. { + BOOST_THROW_EXCEPTION(ScriptError("Bad escape sequence found: " + String(yytext), *yylloc)); + } [^\\\n\"]+ { char *yptr = yytext;