[PATCH][BZ #14134] Fix iconv segfault while converting from IBM-930
Petr Baudis
pasky@ucw.cz
Mon Jun 4 18:07:00 GMT 2012
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
More information about the Libc-alpha
mailing list