This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][BZ #14134] Fix iconv segfault while converting fromIBM-930


On Mon, 4 Jun 2012 20:07:26 +0200, Petr wrote:
> 
>   Silly me, you are right. In that case, the first hunk of the patch
> looks good to me. The second is AIUI still redundant?
> 

Oh right, the second hunk is in fact redundant. I had added it in as an
analogous change without a test case to prove it. I also now understand
why you looked at the opposite conversion; sorry about that.

Updated patch attached.

Thanks,
Siddhesh

2012-05-23  Siddhesh Poyarekar  <siddhesh@redhat.com>

	* iconvdata/ibm930.c (BODY) [FROM_LOOP]: Check for invalid
	character 0xffff that matches the last element of the
	conversion table.
diff --git a/iconvdata/ibm930.c b/iconvdata/ibm930.c
index 25a9be0..74e176e 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'))	      \
 	  {								      \

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]