mirror of
https://sourceware.org/git/glibc.git
synced 2025-09-01 05:02:03 +03:00
Fix handling of conversion problem in CP932 module
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
2011-05-14 Ulrich Drepper <drepper@gmail.com>
|
||||
|
||||
[BZ #12601]
|
||||
* iconvdata/cp932.c (BODY to UCS4): Fix incrementing inptr in case of
|
||||
two-byte sequence errors.
|
||||
* iconvdata/Makefile (tests): Add bug-iconv8.
|
||||
* iconvdata/bug-iconv8.c: New file.
|
||||
|
||||
[BZ #12626]
|
||||
* sysdeps/generic/elf/backtracesymsfd.c (__backtrace_symbols_fd): Move
|
||||
buf2 definition.
|
||||
|
6
NEWS
6
NEWS
@@ -12,9 +12,9 @@ Version 2.14
|
||||
386, 11257, 11258, 11487, 11532, 11578, 11653, 11668, 11724, 11945, 11947,
|
||||
12052, 12158, 12178, 12200, 12346, 12393, 12420, 12432, 12445, 12449,
|
||||
12454, 12460, 12469, 12489, 12509, 12510, 12511, 12518, 12527, 12541,
|
||||
12545, 12551, 12583, 12587, 12597, 12611, 12625, 12626, 12631, 12650,
|
||||
12653, 12655, 12660, 12681, 12685, 12711, 12713, 12714, 12717, 12723,
|
||||
12724, 12734, 12738
|
||||
12545, 12551, 12583, 12587, 12597, 12601, 12611, 12625, 12626, 12631,
|
||||
12650, 12653, 12655, 12660, 12681, 12685, 12711, 12713, 12714, 12717,
|
||||
12723, 12724, 12734, 12738
|
||||
|
||||
* The RPC implementation in libc is obsoleted. Old programs keep working
|
||||
but new programs cannot be linked with the routines in libc anymore.
|
||||
|
@@ -68,7 +68,7 @@ include ../Makeconfig
|
||||
|
||||
ifeq (yes,$(build-shared))
|
||||
tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
|
||||
tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7
|
||||
tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8
|
||||
ifeq ($(have-thread-library),yes)
|
||||
tests += bug-iconv3
|
||||
endif
|
||||
|
43
iconvdata/bug-iconv8.c
Normal file
43
iconvdata/bug-iconv8.c
Normal file
@@ -0,0 +1,43 @@
|
||||
// BZ 12601
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <iconv.h>
|
||||
|
||||
static int
|
||||
do_test (void)
|
||||
{
|
||||
iconv_t cd;
|
||||
char in[] = "\x83\xd9";
|
||||
char out[256];
|
||||
char *inbuf;
|
||||
size_t inbytesleft;
|
||||
char *outbuf;
|
||||
size_t outbytesleft;
|
||||
size_t ret;
|
||||
|
||||
inbuf = in;
|
||||
inbytesleft = sizeof(in) - 1;
|
||||
outbuf = out;
|
||||
outbytesleft = sizeof(out);
|
||||
|
||||
cd = iconv_open("utf-8", "cp932");
|
||||
ret = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||
iconv_close(cd);
|
||||
|
||||
printf("result: %ld %d %ld %d\n", ret, errno, inbytesleft, inbuf[0]);
|
||||
|
||||
/*
|
||||
* result: -1 84 0 0 (84=EILSEQ)
|
||||
*
|
||||
* Error is returnd but inbuf is consumed.
|
||||
*
|
||||
* \x83\xd9 is valid shift-jis sequence but no character is assigned
|
||||
* to it.
|
||||
*/
|
||||
|
||||
return (ret != -1 || errno != EILSEQ
|
||||
|| inbytesleft != 2 || inbuf[0] != in[0]);
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
@@ -1,5 +1,5 @@
|
||||
/* Mapping tables for CP932 handling.
|
||||
Copyright (C) 1997,1998,1999,2000,2001,2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997-2001,2003,2011 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by MORIYAMA Masayuki <msyk@mtg.biglobe.ne.jp>, 2003.
|
||||
|
||||
@@ -4608,8 +4608,7 @@ static const char from_ucs4_extra[229][2] =
|
||||
++*irreversible; \
|
||||
continue; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
\
|
||||
/* We could pack the data a bit more dense. The second \
|
||||
byte will never be 0x7f and it will also be never \
|
||||
>0xfc. But this would mean yet more `if's. */ \
|
||||
@@ -4630,9 +4629,6 @@ static const char from_ucs4_extra[229][2] =
|
||||
else \
|
||||
ch = cjk_block7[(ch - 0xfa) * 192 + ch2 - 0x40]; \
|
||||
\
|
||||
inptr += 2; \
|
||||
} \
|
||||
\
|
||||
if (__builtin_expect (ch, 1) == 0) \
|
||||
{ \
|
||||
/* This is an illegal character. */ \
|
||||
@@ -4647,6 +4643,8 @@ static const char from_ucs4_extra[229][2] =
|
||||
++*irreversible; \
|
||||
continue; \
|
||||
} \
|
||||
\
|
||||
inptr += 2; \
|
||||
} \
|
||||
\
|
||||
put32 (outptr, ch); \
|
||||
|
Reference in New Issue
Block a user