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: Petr Baudis <pasky at ucw dot cz>
- To: Siddhesh Poyarekar <siddhesh at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 4 Jun 2012 20:07:26 +0200
- Subject: Re: [PATCH][BZ #14134] Fix iconv segfault while converting fromIBM-930
- References: <20120523072951.05c5a66f@spoyarek><20120604172116.GA24309@machine.or.cz><20120604232713.16457e1c@spoyarek>
On Mon, Jun 04, 2012 at 11:27:13PM +0530, Siddhesh Poyarekar wrote:
> 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.
Silly me, you are right. In that case, the first hunk of the patch
looks good to me. The second is AIUI still redundant?
--
Petr "Pasky" Baudis
Smart data structures and dumb code works a lot better
than the other way around. -- Eric S. Raymond