This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][BZ #14134] Fix iconv segfault while converting fromIBM-930
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: Petr Baudis <pasky at ucw dot cz>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 4 Jun 2012 23:27:13 +0530
- Subject: Re: [PATCH][BZ #14134] Fix iconv segfault while converting fromIBM-930
- References: <20120523072951.05c5a66f@spoyarek><20120604172116.GA24309@machine.or.cz>
On Mon, 4 Jun 2012 19:21:17 +0200, Petr wrote:
> Shouldn't this be a problem for rp1 (single-byte) table as well?
>
> Also, this just doesn't make sense to me. The termination entry is
> there precisely to break searching the array in the first place, and
> it should work due to the initial test
>
> if (__builtin_expect (ch >= 0xffff, 0)) \
> { \
> UNICODE_TAG_HANDLER (ch, 4); \
> STANDARD_TO_LOOP_ERR_HANDLER (4); \
> }
>
> How can control pass this test if ch == 0xffff?
>
I think you're looking at it the other way around. The crash is for
conversion from ibm930 to utf, which does not have this test. The
above test is there in utf to ibm930. Ditto for single-byte case, since
a single-byte case would be announced by an 0x0f.
To be honest this is the first time I've seen the iconvdata code, but
that's what I get based on my code reading.
--
Siddhesh