From: Ulrich Drepper Date: Sat, 14 May 2011 04:53:21 +0000 (-0400) Subject: Fix handling of incomplete character storage in state X-Git-Tag: glibc-2.14~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1af4e29837e9969377781b47254b6e4c293353ed;p=thirdparty%2Fglibc.git 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. --- diff --git a/ChangeLog b/ChangeLog index a25ddb25c33..6c125e30296 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-05-14 Ulrich Drepper + + * iconv/loop.c (SINGLE) [STORE_REST]: Add input bytes to bytebuf before + storing incomplete byte sequence in state object. + 2011-05-11 Andreas Schwab * Makeconfig (+link-pie): Indent. diff --git a/iconv/loop.c b/iconv/loop.c index da11bc209d3..72fef942228 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 , 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];