diff options
author | Ulrich Drepper <drepper@gmail.com> | 2011-05-14 00:53:21 -0400 |
---|---|---|
committer | Petr Baudis <pasky@ucw.cz> | 2011-05-27 01:29:07 +0200 |
commit | 88a97c6e4cedbd71e05008dab220922894ef66da (patch) | |
tree | 744953d253d4742e4e023c6cf0bf2b9287417059 | |
parent | 82c938203add9de265744987c8f1efa454d80461 (diff) | |
download | glibc-88a97c6e4cedbd71e05008dab220922894ef66da.tar.gz glibc-88a97c6e4cedbd71e05008dab220922894ef66da.tar.xz glibc-88a97c6e4cedbd71e05008dab220922894ef66da.zip |
Fix handling of incomplete character storage in state
If iconv is called more than once in a row for adding bytes to the sequence while still remain under the minimum size of a character and if STORE_REST is defined, we didn't consume any input. Fix that. (cherry picked from commit 1af4e29837e9969377781b47254b6e4c293353ed)
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | iconv/loop.c | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index 221f8a9118..3f05f09114 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-05-14 Ulrich Drepper <drepper@gmail.com> + + * iconv/loop.c (SINGLE) [STORE_REST]: Add input bytes to bytebuf before + storing incomplete byte sequence in state object. + 2011-05-13 Ulrich Drepper <drepper@gmail.com> [BZ #12724] diff --git a/iconv/loop.c b/iconv/loop.c index da11bc209d..72fef94222 100644 --- a/iconv/loop.c +++ b/iconv/loop.c @@ -1,5 +1,5 @@ /* Conversion loop frame work. - Copyright (C) 1998-2002, 2003, 2005, 2008 Free Software Foundation, Inc. + Copyright (C) 1998-2003, 2005, 2008, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -399,6 +399,9 @@ SINGLE(LOOPFCT) (struct __gconv_step *step, { *inptrp = inend; #ifdef STORE_REST + while (inptr < inend) + bytebuf[inlen++] = *inptr++; + inptr = bytebuf; inptrp = &inptr; inend = &bytebuf[inlen]; |