kernelbase: Use translated Unicode default char to check invalid chars.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48288
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2019-12-16 22:39:41 +09:00 committed by Alexandre Julliard
parent 3bb92d7773
commit a85bc781d3
2 changed files with 6 additions and 3 deletions

View File

@ -1005,12 +1005,15 @@ static void test_undefined_byte_char(void)
LPCSTR str;
BOOL is_error;
} testset[] = {
{ 37, "\x6f", FALSE },
{ 874, "\xdd", TRUE },
{ 932, "\xfe", TRUE },
{ 932, "\x80", FALSE },
{ 932, "\x81\x45", FALSE },
{ 936, "\xff", TRUE },
{ 949, "\xff", TRUE },
{ 950, "\xff", TRUE },
{ 1252, "?", FALSE },
{ 1252, "\x90", FALSE },
{ 1253, "\xaa", TRUE },
{ 1255, "\xff", TRUE },

View File

@ -1044,12 +1044,12 @@ static int check_invalid_chars( const CPTABLEINFO *info, const unsigned char *sr
{
if (srclen == 1) break; /* partial char, error */
if (info->DBCSOffsets[off + src[1]] == info->UniDefaultChar &&
((src[0] << 8) | src[1]) != info->TransDefaultChar) break;
((src[0] << 8) | src[1]) != info->TransUniDefaultChar) break;
src++;
srclen--;
continue;
}
if (info->MultiByteTable[*src] == info->UniDefaultChar && *src != info->TransDefaultChar)
if (info->MultiByteTable[*src] == info->UniDefaultChar && *src != info->TransUniDefaultChar)
break;
if (is_private_use_area_char( info->MultiByteTable[*src] )) break;
}
@ -1058,7 +1058,7 @@ static int check_invalid_chars( const CPTABLEINFO *info, const unsigned char *sr
{
for ( ; srclen; src++, srclen-- )
{
if (info->MultiByteTable[*src] == info->UniDefaultChar && *src != info->TransDefaultChar)
if (info->MultiByteTable[*src] == info->UniDefaultChar && *src != info->TransUniDefaultChar)
break;
if (is_private_use_area_char( info->MultiByteTable[*src] )) break;
}