about summary refs log tree commit diff
path: root/iconv/loop.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-05-14 00:53:21 -0400
committerUlrich Drepper <drepper@gmail.com>2011-05-14 00:53:21 -0400
commit1af4e29837e9969377781b47254b6e4c293353ed (patch)
treeef585980f3ebb3250a75ed77f3b2dffa9424a7b0 /iconv/loop.c
parentda62f81bdd23bb5095cd54c0b34ae6d5a93df69e (diff)
downloadglibc-1af4e29837e9969377781b47254b6e4c293353ed.tar.gz
glibc-1af4e29837e9969377781b47254b6e4c293353ed.tar.xz
glibc-1af4e29837e9969377781b47254b6e4c293353ed.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.
Diffstat (limited to 'iconv/loop.c')
-rw-r--r--iconv/loop.c5
1 files changed, 4 insertions, 1 deletions
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];