From: Gunnar Beutner Date: Sat, 20 Dec 2014 08:48:18 +0000 (+0100) Subject: Report error for invalid escape sequences X-Git-Tag: v2.3.0~430 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e03e143177178f4d41e36a90e6306785002987c4;p=icinga2 Report error for invalid escape sequences fixes #7910 --- 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;