glibc/glibc-rh823905.patch
Patsy Franklin 1559b7b925 Resolves: sw14134
- Fix iconv() segfault when the invalid multibyte character 0xffff is input when
  converting from IBM930.
2012-06-01 15:08:41 -04:00

26 lines
979 B
Diff

diff --git a/iconvdata/ibm930.c b/iconvdata/ibm930.c
index 25a9be0..6f758eb 100644
--- a/iconvdata/ibm930.c
+++ b/iconvdata/ibm930.c
@@ -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')) \
{ \
@@ -215,7 +216,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) \
|| (cp = __ucs4_to_ibm930db[ch + rp2->idx], \
__builtin_expect (cp[0], L'\1')== L'\0' && ch != '\0')) \
{ \