perl-unicode

Re: Tk804 + Encode-1.50 :-) again

2002-04-19 16:06:38
By the time you read this you must have just awake.

On Saturday, April 20, 2002, at 07:07 , Nick Ing-Simmons wrote:
Near line 181 of Encode.xs (tail of main while loop):

            /* settle variables when fallback */
            dlen = SvCUR(dst);
            d   = (U8*)SvPVX(dst) + dlen;
            s   = (U8*)SvPVX(src) + sdone;
            slen = tlen - sdone;
            break;

When calling do_encode() at top of loop dlen is supposed to be number
of bytes _available_ at d, and you have it as number of bytes _used_.
So if we have used most of it and then insert a fallback do_encode()
will zoom off the end of the SV.

I think (too late here for morning person like me to think well) that

            d = (U8 *) SvEND(dst);
            dlen = SvLEN(dst) - ddone - 1;

is closer to correct ..

I changed Encode.xs accordingly and t/fallback says it is okay. Please tell me if this will fix the problem you found. With this and Autrijus new ucm problem resolved, I'll go ahead release 1.51.

Dan

<Prev in Thread] Current Thread [Next in Thread>