wrc: Only allow 7-bit ASCII characters in wide string constants.

This commit is contained in:
Alexandre Julliard 2010-12-05 16:33:13 +01:00
parent 23cd52e559
commit 577f202d25
1 changed files with 10 additions and 2 deletions

View File

@ -470,7 +470,11 @@ L\" {
<tklstr>\\r addwchar('\r'); <tklstr>\\r addwchar('\r');
<tklstr>\\t addwchar('\t'); <tklstr>\\t addwchar('\t');
<tklstr>\\v addwchar('\v'); <tklstr>\\v addwchar('\v');
<tklstr>\\. addwchar(yytext[1]); <tklstr>\\. {
if (yytext[1] & 0x80)
parser_error("Invalid char %u in wide string", (unsigned char)yytext[1]);
addwchar(yytext[1]);
}
<tklstr>\\\r\n addwchar(yytext[2]); line_number++; char_number = 1; <tklstr>\\\r\n addwchar(yytext[2]); line_number++; char_number = 1;
<tklstr>\"\" addwchar('\"'); /* "bla""bla" -> "bla\"bla" */ <tklstr>\"\" addwchar('\"'); /* "bla""bla" -> "bla\"bla" */
<tklstr>\\\"\" addwchar('\"'); /* "bla\""bla" -> "bla\"bla" */ <tklstr>\\\"\" addwchar('\"'); /* "bla\""bla" -> "bla\"bla" */
@ -478,8 +482,12 @@ L\" {
<tklstr>[^\\\n\"]+ { <tklstr>[^\\\n\"]+ {
char *yptr = yytext; char *yptr = yytext;
while(*yptr) /* FIXME: codepage translation */ while(*yptr) /* FIXME: codepage translation */
{
if (*yptr & 0x80)
parser_error("Invalid char %u in wide string", (unsigned char)*yptr);
addwchar(*yptr++ & 0xff); addwchar(*yptr++ & 0xff);
} }
}
<tklstr>\n parser_error("Unterminated string"); <tklstr>\n parser_error("Unterminated string");
/* /*