develooper Front page | perl.perl5.porters | Postings from April 2003

Re: [PATCH] Perl_croak("Use of freed value in iteration")

Thread Previous | Thread Next
Rafael Garcia-Suarez
April 21, 2003 05:30
Re: [PATCH] Perl_croak("Use of freed value in iteration")
Message ID:
Dave Mitchell wrote:
> It's a well-known bug that deleting things while iterating over items
> on the stack causes nasty coredumps, eg
>     @a = (3,4);
>     @a = () for (1,2,@a);
> This is because items on the stack aren't ref counted. This is too hard
> to fix, but the following patch applies the princple of post-equine-exit-
> paddock-area-securing, by giving a fatal error if it iterates over a freed
> value. Better a strange warning than a coredump?
> PS - I wasn't sure where to put a test - cmd/for.t sounds likely, but
> it needs a fresh Perl, so would it be be okay to add "require" in
> such a base test file?

Why do you need a fresh perl ?
eval {} should be sufficient (once the bug is fixed ;-)

> +=item Use of freed value in iteration (perhaps you modified the iterated array within the loop?)
> +
> +(F) This is typically caused by code like the following:
Unmarked is not *NIX

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About