Alexandre Julliard : wrc: Only allow 7-bit ASCII characters in wide string constants.
Alexandre Julliard
julliard at winehq.org
Sun Dec 5 12:10:08 CST 2010
Module: wine
Branch: master
Commit: 577f202d25005aae5aa61c456d838e1d7bbb6bef
URL: http://source.winehq.org/git/wine.git/?a=commit;h=577f202d25005aae5aa61c456d838e1d7bbb6bef
Author: Alexandre Julliard <julliard at winehq.org>
Date: Sun Dec 5 16:33:13 2010 +0100
wrc: Only allow 7-bit ASCII characters in wide string constants.
---
tools/wrc/parser.l | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/wrc/parser.l b/tools/wrc/parser.l
index 834c568..a1ef1cf 100644
--- a/tools/wrc/parser.l
+++ b/tools/wrc/parser.l
@@ -470,7 +470,11 @@ L\" {
<tklstr>\\r addwchar('\r');
<tklstr>\\t addwchar('\t');
<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>\"\" addwchar('\"'); /* "bla""bla" -> "bla\"bla" */
<tklstr>\\\"\" addwchar('\"'); /* "bla\""bla" -> "bla\"bla" */
@@ -478,7 +482,11 @@ L\" {
<tklstr>[^\\\n\"]+ {
char *yptr = yytext;
while(*yptr) /* FIXME: codepage translation */
- addwchar(*yptr++ & 0xff);
+ {
+ if (*yptr & 0x80)
+ parser_error("Invalid char %u in wide string", (unsigned char)*yptr);
+ addwchar(*yptr++ & 0xff);
+ }
}
<tklstr>\n parser_error("Unterminated string");
More information about the wine-cvs
mailing list