wrc: Only allow 7-bit ASCII characters in wide string constants.
This commit is contained in:
parent
23cd52e559
commit
577f202d25
|
@ -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");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue