about summary refs log tree commit diff
path: root/iconvdata/big5hkscs.c
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@redhat.com>2020-03-27 17:03:36 -0400
committerCarlos O'Donell <carlos@redhat.com>2020-04-15 22:31:40 -0400
commitc580e6466d6da8262820cdbad19f32c5546226cf (patch)
tree99e73b8ab0eab515886cf4ce378be54873f5a494 /iconvdata/big5hkscs.c
parent70dfcd9b6c6fab492380a33b79e99cb9f9f438e9 (diff)
downloadglibc-c580e6466d6da8262820cdbad19f32c5546226cf.tar.gz
glibc-c580e6466d6da8262820cdbad19f32c5546226cf.tar.xz
glibc-c580e6466d6da8262820cdbad19f32c5546226cf.zip
Reset converter state after second wchar_t output (Bug 25734)
An input BIG5-HKSCS character may be converted into at most 2 wchar_t
characters. After outputting the second whcar_t character (which was
saved in the converter state) we must reset the state. If we fail
to reset the state we will be stuck continually copying that
character to the output even if we have further input to consider.

We add a new test case that covers the 4 BIG5-HKSCS characters
that may become 2 wchar_t characters.

Reviewed-by: Tom Honermann <tom@honermann.net>
Diffstat (limited to 'iconvdata/big5hkscs.c')
-rw-r--r--iconvdata/big5hkscs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/iconvdata/big5hkscs.c b/iconvdata/big5hkscs.c
index 01fcfeba76..ef325119b1 100644
--- a/iconvdata/big5hkscs.c
+++ b/iconvdata/big5hkscs.c
@@ -17895,6 +17895,9 @@ static struct
 	else								      \
 	  ++inptr;							      \
       }									      \
+    else								      \
+      /* Clear the queue and proceed to output the saved character.  */	      \
+      *statep = 0;							      \
 									      \
     put32 (outptr, ch);							      \
     outptr += 4;							      \