aboutsummaryrefslogtreecommitdiff
path: root/iconvdata
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2012-06-06 18:39:10 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2012-06-06 18:41:55 +0530
commit6e230d11837f3ae7b375ea69d7905f0d18eb79e5 (patch)
tree9f28c8ad04d625474d52cee21e7ab965efee251a /iconvdata
parent1b671feb6115afbc90a7b37be4929d3e0394f311 (diff)
downloadglibc-6e230d11837f3ae7b375ea69d7905f0d18eb79e5.zip
glibc-6e230d11837f3ae7b375ea69d7905f0d18eb79e5.tar.gz
glibc-6e230d11837f3ae7b375ea69d7905f0d18eb79e5.tar.bz2
Fix validation check when converting from ibm930 to utf
[BZ #14134] When converting IBM930 code with iconv(), if IBM930 code which includes invalid multibyte character "0xffff" is specified, then iconv() segfaults. This is easy to see using the following command: echo '0x0e 0x43 0x8c 0xff 0xff 0x43 0xbd 0x43 0xbd' | xxd -r | iconv -f IBM930 -t UTF-8
Diffstat (limited to 'iconvdata')
-rw-r--r--iconvdata/ibm930.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/iconvdata/ibm930.c b/iconvdata/ibm930.c
index 25a9be0..587d54f 100644
--- a/iconvdata/ibm930.c
+++ b/iconvdata/ibm930.c
@@ -1,5 +1,5 @@
/* Conversion from and to IBM930.
- Copyright (C) 2000-2002, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2000-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Masahide Washizawa <washi@yamato.ibm.co.jp>, 2000.
@@ -162,7 +162,8 @@ enum
while (ch > rp2->end) \
++rp2; \
\
- if (__builtin_expect (ch < rp2->start, 0) \
+ if (__builtin_expect (rp2->start == 0xffff, 0) \
+ || __builtin_expect (ch < rp2->start, 0) \
|| (res = __ibm930db_to_ucs4[ch + rp2->idx], \
__builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
{ \