develooper Front page | perl.perl5.porters | Postings from December 2004

Re: [perl #33185] UTF-8 string substitution corrupts memory

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
December 31, 2004 08:11
Subject:
Re: [perl #33185] UTF-8 string substitution corrupts memory
Message ID:
20041231161116.GC13874@iabyn.com
On Fri, Dec 31, 2004 at 03:04:49PM +0000, hv@crypt.org wrote:
> Nicholas Clark <nick@ccl4.org> wrote:
> :The appended patch seems to cure the problem for me, but I'm not confident
> :that it's the correct way.
> 
> I notice that this changes the order things are stacked; I'm not sure if
> that's ever going to be relevant. In particularly this swaps the first
> two of the sequence:
>   PUSHSTACKi; ENTER; LEAVE; POPSTACK
> .. but I'm not sure what they all do without expanding a lot of macros.

I'd have thought that the better approach would be to move the

    if (!gv_fetchmeth(stash, "SWASHNEW", 8, -1)) {	/* demand load utf8 */

block further down to just above the line

    if (call_method("SWASHNEW", G_SCALAR))

then the call to Perl_load_module is protected by the PUSHSTACKi. Note
that PUSHSTACKi is needed any place where the caller isn't prepared for
the stack to get extended and thus possibly reallocated (thus invalidating
SP etc). It gives you a brand new stack to play with.

-- 
In England there is a special word which means the last sunshine
of the summer. That word is "spring".

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About