Skip to content

Commit

Permalink
Fix handling of incomplete character storage in state
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
drepper committed May 14, 2011
1 parent da62f81 commit 1af4e29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions 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-11 Andreas Schwab <schwab@redhat.com>

* Makeconfig (+link-pie): Indent.
Expand Down
5 changes: 4 additions & 1 deletion 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.
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 1af4e29

Please sign in to comment.