clone 537996 -1
reassign -1 perl 5.10.0-19
retitle -1 segfault calling SvIV() after perl_run()
tag 537996 patch
thanks

On Sun, Jul 26, 2009 at 05:01:39PM +0200, Tomaž Šolc wrote:
> >> Somebody with deeper knowledge of Perl guts will have to tell if it just
> >> fixes the symptoms or the cause of the bug.

> With some trial-and-error I came up with the attached script - that's
> the shortest script I can get to crash.

I'm attaching a core-only version of the test script and a short C program
that embeds Perl and crashes in the same way on i386 when running the
test script with '-w'.

I'll apply your SvTRUE workaround for speedy-cgi-perl, but I'm cloning
a separate bug against perl. If the C program is doing something wrong,
I suppose perlembed.pod should have a note about it.

FWIW, I see the crashing code in the Perl core was briefly changed not
to crash as a workaround for another bug. 

Resetting PL_op works here too, but should it be needed?

 
http://perl5.git.perl.org/perl.git/commitdiff/d4f41c0196a61a9d6f38ee42fc192ebf28ef6420

 
http://perl5.git.perl.org/perl.git/commitdiff/cecbe0108c1c5a1c170a53b486232d7a592e3312

 
http://perl5.git.perl.org/perl.git/commitdiff/30c8d9e411f7375ddf81a32aa625d6c0e0c39091

Cheers,
-- 
Niko Tyni   [email protected] 
my $q;
sub f {}
sub g {
	$q = f();
	exit 0;
}
g();
#include <EXTERN.h>               /* from the Perl distribution     */
#include <perl.h>                 /* from the Perl distribution     */

static PerlInterpreter *my_perl;  /***    The Perl interpreter    ***/

int main(int argc, char **argv, char **env)
{
    SV *t;
	PERL_SYS_INIT3(&argc,&argv,&env);
	my_perl = perl_alloc();
	perl_construct(my_perl);
	perl_parse(my_perl, NULL, argc, argv, (char **)NULL);
    t = get_sv("v", 1); /* create the variable */
	perl_run(my_perl);
	printf("value: %d\n", SvIV(t));
	perl_destruct(my_perl);
	perl_free(my_perl);
	PERL_SYS_TERM();
}

Reply via email to