Skip to content
This repository was archived by the owner on Feb 5, 2022. It is now read-only.

Commit f2a8406

Browse files
author
Ulrich Drepper
committed
[BZ #5277]
2007-11-07 Ulrich Drepper <[email protected]> [BZ #5277] * iconv/loop.c (STANDARD_TO_LOOP_ERR_HANDLER): If conversion failed because output buffer is too small break, don't loop. * iconvdata/Makefile (tests): Add bug-iconv6. * iconvdata/bug-iconv6.c: New file.
1 parent 9ca230d commit f2a8406

File tree

6 files changed

+76
-6
lines changed

6 files changed

+76
-6
lines changed

ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2007-11-07 Ulrich Drepper <[email protected]>
2+
3+
[BZ #5277]
4+
* iconv/loop.c (STANDARD_TO_LOOP_ERR_HANDLER): If conversion failed
5+
because output buffer is too small break, don't loop.
6+
* iconvdata/Makefile (tests): Add bug-iconv6.
7+
* iconvdata/bug-iconv6.c: New file.
8+
19
2007-11-06 Ulrich Drepper <[email protected]>
210

311
* stdio-common/vfprintf.c (vfprintf): Compute necessary buffer size

iconv/loop.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,12 @@
225225
} \
226226
/* If any of them recognized the input continue with the loop. */ \
227227
if (result != __GCONV_ILLEGAL_INPUT) \
228-
continue; \
228+
{ \
229+
if (__builtin_expect (result == __GCONV_FULL_OUTPUT, 0)) \
230+
break; \
231+
\
232+
continue; \
233+
} \
229234
\
230235
/* Next see whether we have to ignore the error. If not, stop. */ \
231236
if (! ignore_errors_p ()) \

iconvdata/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ include ../Makeconfig
6767

6868
ifeq (yes,$(build-shared))
6969
tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
70-
tst-iconv6 bug-iconv5
70+
tst-iconv6 bug-iconv5 bug-iconv6
7171
ifeq ($(have-thread-library),yes)
7272
tests += bug-iconv3
7373
endif

iconvdata/bug-iconv6.c

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#include <string.h>
2+
#include <stdio.h>
3+
#include <stdlib.h>
4+
#include <errno.h>
5+
#include <iconv.h>
6+
#include <locale.h>
7+
8+
static const char testbuf[] = {
9+
0xEF, 0xBE, 0x9F, 0xD0, 0xB4, 0xEF, 0xBE, 0x9F, 0x29, 0xEF, 0xBE, 0x8E,
10+
0xEF, 0xBE, 0x9F, 0xEF, 0xBD, 0xB6, 0xEF, 0xBD, 0xB0, 0xEF, 0xBE, 0x9D
11+
};
12+
13+
static int
14+
do_test (void)
15+
{
16+
setlocale (LC_ALL, "en_US.UTF-8");
17+
iconv_t ic = iconv_open ("ISO-2022-JP//TRANSLIT", "UTF-8");
18+
if (ic == (iconv_t) -1)
19+
{
20+
puts ("iconv_open failed");
21+
return 1;
22+
}
23+
size_t outremain = sizeof testbuf;
24+
char outbuf[outremain];
25+
char *inp = (char *) testbuf;
26+
char *outp = outbuf;
27+
size_t inremain = sizeof testbuf;
28+
29+
int ret = iconv (ic, &inp, &inremain, &outp, &outremain);
30+
31+
int result = 0;
32+
if (ret == (size_t) -1)
33+
{
34+
if (errno == E2BIG)
35+
puts ("buffer too small reported. OK");
36+
else
37+
{
38+
printf ("iconv failed with %d (%m)\n", errno);
39+
result = 0;
40+
}
41+
}
42+
else
43+
{
44+
printf ("iconv returned %d\n", ret);
45+
result = 1;
46+
}
47+
48+
return result;
49+
}
50+
51+
#define TEST_FUNCTION do_test ()
52+
#include "../test-skeleton.c"

localedata/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2007-11-07 Ulrich Drepper <[email protected]>
2+
3+
[BZ #5237]
4+
* locales/lo_LA: Fix typos in collation symbols.
5+
16
2007-11-06 Ulrich Drepper <[email protected]>
27

38
* locales/dz_BT: Fix representation of data.

localedata/locales/lo_LA

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,10 +602,10 @@ UNDEFINED IGNORE;IGNORE;IGNORE;IGNORE
602602

603603
<U0EDD> <U0EDC>;<BLANK>;<BLANK>;<BLANK> % Lao CHARACTER HHOr
604604
<mhor-e> "<U0EDD><U0EC0>";<BLANK>;<BLANK>;<BLANK>
605-
<mor-ae> "<U0EDD><U0EC1>";<BLANK>;<BLANK>;<BLANK>
606-
<mor-o> "<U0EDD><U0EC2>";<BLANK>;<BLANK>;<BLANK>
607-
<mor-ai-maimuan> "<U0EDD><U0EC3>";<BLANK>;<BLANK>;<BLANK>
608-
<mor-ai-maimalai> "<U0EDD><U0EC4>";<BLANK>;<BLANK>;<BLANK>
605+
<mhor-ae> "<U0EDD><U0EC1>";<BLANK>;<BLANK>;<BLANK>
606+
<mhor-o> "<U0EDD><U0EC2>";<BLANK>;<BLANK>;<BLANK>
607+
<mhor-ai-maimuan> "<U0EDD><U0EC3>";<BLANK>;<BLANK>;<BLANK>
608+
<mhor-ai-maimalai> "<U0EDD><U0EC4>";<BLANK>;<BLANK>;<BLANK>
609609

610610

611611
% order of Lao vowels

0 commit comments

Comments
 (0)