Commit b02cdd36 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

kernel32: Fix LCMapString buffer calculation with LCMAP_KATAKANA and LCMAP_HALFWIDTH.

parent 96b4a5a3
......@@ -3557,8 +3557,16 @@ INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, LPW
else if (flags & LCMAP_HALFWIDTH)
{
for (len = 0; srclen; src++, srclen--, len++)
if (decompose_katakana(*src, NULL, 0) == 2)
{
WCHAR wch = *src;
/* map Hiragana to Katakana before decomposition if needed */
if ((flags & LCMAP_KATAKANA) &&
((wch >= 0x3041 && wch <= 0x3096) || wch == 0x309D || wch == 0x309E))
wch += 0x60;
if (decompose_katakana(wch, NULL, 0) == 2)
len++;
}
}
else
len = srclen;
......
......@@ -2537,7 +2537,6 @@ static void test_lcmapstring_unicode(lcmapstring_wrapper func_ptr, const char *f
ok(!lstrcmpW(buf, halfwidth_text2), "%s string compare mismatch\n", func_name);
ret2 = func_ptr(LCMAP_HALFWIDTH | LCMAP_KATAKANA, japanese_text, -1, NULL, 0);
todo_wine
ok(ret == ret2, "%s ret %d, expected value %d\n", func_name, ret, ret2);
/* test buffer overflow */
......
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