diff --git a/dlls/kernel32/tests/codepage.c b/dlls/kernel32/tests/codepage.c index 3161b8b7dd0..8eccf9990e0 100644 --- a/dlls/kernel32/tests/codepage.c +++ b/dlls/kernel32/tests/codepage.c @@ -1211,9 +1211,9 @@ static void test_dbcs_to_widechar(void) { WCHAR wbuf_ok[] = { 0x770b, 0x003f, '\0', 0xffff }; WCHAR wbuf_broken[] = { 0x770b, '\0', 0xffff, 0xffff }; - todo_wine ok(count == 3 || broken(count == 2 /*windows xp*/), + ok(count == 3 || broken(count == 2 /*windows xp*/), "%04x: returned %d (expected 3)\n", flags[i], count); - todo_wine ok(!memcmp(wbuf, wbuf_ok, sizeof(wbuf_ok)) + ok(!memcmp(wbuf, wbuf_ok, sizeof(wbuf_ok)) || broken(!memcmp(wbuf, wbuf_broken, sizeof(wbuf_broken))), "%04x: returned %04x %04x %04x %04x (expected %04x %04x %04x %04x)\n", flags[i], wbuf[0], wbuf[1], wbuf[2], wbuf[3], @@ -1240,9 +1240,9 @@ static void test_dbcs_to_widechar(void) { WCHAR wbuf_ok[] = { 0x770b, 0x003f, '\0', 'x', 0xffff }; WCHAR wbuf_broken[] = { 0x770b, '\0', 'x', 0xffff, 0xffff }; - todo_wine ok(count == 4 || broken(count == 3), + ok(count == 4 || broken(count == 3), "%04x: returned %d (expected 4)\n", flags[i], count); - todo_wine ok(!memcmp(wbuf, wbuf_ok, sizeof(wbuf_ok)) + ok(!memcmp(wbuf, wbuf_ok, sizeof(wbuf_ok)) || broken(!memcmp(wbuf, wbuf_broken, sizeof(wbuf_broken))), "%04x: returned %04x %04x %04x %04x %04x (expected %04x %04x %04x %04x %04x)\n", flags[i], wbuf[0], wbuf[1], wbuf[2], wbuf[3], wbuf[4], diff --git a/libs/port/mbtowc.c b/libs/port/mbtowc.c index fd7764eb9c7..4977c82d8b1 100644 --- a/libs/port/mbtowc.c +++ b/libs/port/mbtowc.c @@ -131,7 +131,7 @@ static inline int get_length_dbcs( const struct dbcs_table *table, for (len = 0; srclen; srclen--, src++, len++) { - if (cp2uni_lb[*src] && srclen > 1) + if (cp2uni_lb[*src] && srclen > 1 && src[1]) { src++; srclen--; @@ -183,7 +183,7 @@ static inline int mbstowcs_dbcs( const struct dbcs_table *table, for (len = dstlen; srclen && len; len--, srclen--, src++, dst++) { unsigned char off = cp2uni_lb[*src]; - if (off && srclen > 1) + if (off && srclen > 1 && src[1]) { src++; srclen--; @@ -212,7 +212,7 @@ static int mbstowcs_dbcs_decompose( const struct dbcs_table *table, for (len = 0; srclen; srclen--, src++) { unsigned char off = cp2uni_lb[*src]; - if (off && srclen > 1) + if (off && srclen > 1 && src[1]) { src++; srclen--; @@ -227,7 +227,7 @@ static int mbstowcs_dbcs_decompose( const struct dbcs_table *table, for (len = dstlen; srclen && len; srclen--, src++) { unsigned char off = cp2uni_lb[*src]; - if (off && srclen > 1) + if (off && srclen > 1 && src[1]) { src++; srclen--;