From: Rafael Garcia-Suarez Date: Sun, 2 Nov 2003 21:05:59 +0000 (+0000) Subject: Fix for [perl #24347] segfault with Safe X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4adfac04910258ae156d305cec3778a76f618ae6;p=p5sagit%2Fp5-mst-13.2.git Fix for [perl #24347] segfault with Safe The empty %INC created for safe compartements was freed too early. p4raw-id: //depot/perl@21628 --- diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs index 66710ed..51be8bf 100644 --- a/ext/Opcode/Opcode.xs +++ b/ext/Opcode/Opcode.xs @@ -288,6 +288,7 @@ _safe_call_sv(Package, mask, codesv) PPCODE: char op_mask_buf[OP_MASK_BUF_SIZE]; GV *gv; + HV *dummy_hv; ENTER; @@ -311,12 +312,12 @@ PPCODE: GvHV(gv) = (HV*)SvREFCNT_inc(PL_defstash); /* %INC must be clean for use/require in compartment */ - save_hash(PL_incgv); - sv_free((SV*)GvHV(PL_incgv)); /* get rid of what save_hash gave us*/ + dummy_hv = save_hash(PL_incgv); GvHV(PL_incgv) = (HV*)SvREFCNT_inc(GvHV(gv_HVadd(gv_fetchpv("INC",TRUE,SVt_PVHV)))); PUSHMARK(SP); perl_call_sv(codesv, GIMME|G_EVAL|G_KEEPERR); /* use callers context */ + sv_free(dummy_hv); /* get rid of what save_hash gave us*/ SPAGAIN; /* for the PUTBACK added by xsubpp */ LEAVE;