Commit 67fbcff7 authored by Jinoh Kang's avatar Jinoh Kang Committed by Alexandre Julliard

wbemprox: Fix out-of-bounds access caused by codepoints above U+00FF.

Windows seems to recognize Unicode codepoints above U+007F as a valid identifier character regardless of their actual character class. Mimic that behaviour.
parent 0fac6c11
......@@ -94,6 +94,12 @@ static void test_select( IWbemServices *services )
L"SELECT * FROM Win32_BIOS WHERE NULL = NAME",
L"SELECT * FROM Win32_LogicalDiskToPartition",
L"SELECT * FROM Win32_DiskDriveToDiskPartition",
L"SELECT \x80 FROM \x80",
L"SELECT \xC6 FROM \xC6",
L"SELECT \xFF FROM \xFF",
L"SELECT \x200C FROM \x200C",
L"SELECT \xFF21 FROM \xFF21",
L"SELECT \xFFFD FROM \xFFFD",
};
HRESULT hr;
IEnumWbemClassObject *result;
......
......@@ -645,6 +645,11 @@ static const char id_char[] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
};
static int is_idchar(WCHAR chr)
{
return chr >= ARRAY_SIZE(id_char) || id_char[chr];
}
struct wql_keyword
{
const WCHAR *name;
......@@ -802,9 +807,9 @@ static int get_token( const WCHAR *s, int *token )
for (i = 1; is_digit( s[i] ); i++) {}
return i;
default:
if (!id_char[*s]) break;
if (!is_idchar(*s)) break;
for (i = 1; id_char[s[i]]; i++) {}
for (i = 1; is_idchar(s[i]); i++) {}
*token = keyword_type( s, i );
return i;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment