]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix handling of incomplete character storage in state
authorUlrich Drepper <drepper@gmail.com>
Sat, 14 May 2011 04:53:21 +0000 (00:53 -0400)
committerPetr Baudis <pasky@ucw.cz>
Thu, 26 May 2011 23:29:07 +0000 (01:29 +0200)
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)

ChangeLog
iconv/loop.c

index 221f8a91188b90a7499172671b3526b3236cf5a7..3f05f091144ea8a19bce5201c8dd0c062f5d820f 100644 (file)
--- 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]
index da11bc209d3755f0d1100d497545d1341603e676..72fef942228a9b3c53649684699637af6f13a581 100644 (file)
@@ -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];