From: Francis De Brabandere <francisdb@gmail.com> --- dlls/vbscript/lex.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/vbscript/lex.c b/dlls/vbscript/lex.c index 71ecaa43278..12305ab671b 100644 --- a/dlls/vbscript/lex.c +++ b/dlls/vbscript/lex.c @@ -110,6 +110,10 @@ static inline BOOL is_identifier_char(WCHAR c) return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_'; } +/* Compare the current parse position against a keyword using ASCII-only + * case-insensitive matching. Keywords are all lowercase ASCII, so we only + * need to lowercase [A-Z] in the source. Returns 0 on match, <0 or >0 + * for ordering (used by the binary search in check_keywords). */ static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lval) { const WCHAR *p1 = ctx->ptr; @@ -117,7 +121,8 @@ static int check_keyword(parser_ctx_t *ctx, const WCHAR *word, const WCHAR **lva WCHAR c; while(p1 < ctx->end && *p2) { - c = towlower(*p1); + c = *p1; + if(c >= 'A' && c <= 'Z') c += 'a' - 'A'; if(c != *p2) return c - *p2; p1++; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10544