]> granicus.if.org Git - icinga2/commitdiff
Report error for invalid escape sequences
authorGunnar Beutner <gunnar@beutner.name>
Sat, 20 Dec 2014 08:48:18 +0000 (09:48 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Sat, 20 Dec 2014 08:48:18 +0000 (09:48 +0100)
fixes #7910

lib/config/config_lexer.ll

index a32163fddb6c5aa6ce54e99970540706ac3c67e6..15efe4b1078c96a2c1e40ae5589a09f10355613a 100644 (file)
@@ -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<char>(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));
                                }
 
 <STRING>\\n                    { yyextra->m_LexBuffer << "\n"; }
@@ -107,7 +107,10 @@ do {                                                       \
 <STRING>\\r                    { yyextra->m_LexBuffer << "\r"; }
 <STRING>\\b                    { yyextra->m_LexBuffer << "\b"; }
 <STRING>\\f                    { yyextra->m_LexBuffer << "\f"; }
-<STRING>\\(.|\n)               { yyextra->m_LexBuffer << yytext[1]; }
+<STRING>\\\n                   { yyextra->m_LexBuffer << yytext[1]; }
+<STRING>\\.                    {
+       BOOST_THROW_EXCEPTION(ScriptError("Bad escape sequence found: " + String(yytext), *yylloc));
+                               }
 
 <STRING>[^\\\n\"]+             {
        char *yptr = yytext;