develooper Front page | perl.perl5.porters | Postings from October 2013

Re: Padlist NULL pointer?

Thread Previous | Thread Next
From:
Marc Lehmann
Date:
October 30, 2013 14:05
Subject:
Re: Padlist NULL pointer?
Message ID:
20131030140521.GB4317@schmorp.de
On Wed, Oct 30, 2013 at 01:00:51PM -0000, Father Chrysostomos <sprout@cpan.org> wrote:
> > I'm just looking for where a
> > patch may be required to stop the seg fault.
> 
> Does this work?  I have not tested it yet.

Looks like data corruption :)

To reach it's goal (get a fresh padlist), Coro's strategy is to use
pad_push to create a new pad, and then steal it, to create a fresh padlist
with it, while sharing names and protopad. The stealing isn't perfect (it
reduces padlistmax), but doesn't leak.

With your patch, it looks as it would avoid the segfault, but it would
either leak memory (because it sets max to something lower), or share
padlists (because it doesn't steal the actual pad). Maybe I am wrong,
but I think removing a pad from the middle of the padlist is asking for
trouble.

I can imagine an algorithm that first tries to steal the highest existing
pad (between cvdepth and max), or creates a new one if none exist.

A bit ugly but would work. However, I would really appreciate if somebody who
understands the new pad system would point me at the code that actually
creates 0-pad-ptr entries - maybe a better solution is possible, a solution
that doesn't require guessing on my side :)

Now, if perl had a function that creates a new frash padlist for a cv, that
would make things much easier... :)

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp@schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\

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