Skip to content

Commit

Permalink
Delete the CORE/prevailing_version key from the hint hash inside stri…
Browse files Browse the repository at this point in the history
…ng eval so perl code doesn't get to see it
  • Loading branch information
leonerd committed Apr 27, 2024
1 parent f4a8839 commit abc5e0f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pp_ctl.c
Expand Up @@ -4077,11 +4077,18 @@ S_doeval_compile(pTHX_ U8 gimme, CV* outside, U32 seq, HV *hh)
SvREFCNT_dec(GvHV(PL_hintgv));
GvHV(PL_hintgv) = hh;
FETCHFEATUREBITSHH(hh);
SV *versv, **svp;
if((svp = hv_fetchs(hh, "CORE/prevailing_version", 0)) && (versv = *svp) && SvOK(versv)) {
/* temporarily turn magical flags off so we can delete without it getting in the way */
const U32 wasflags = SvFLAGS(hh);
SvMAGICAL_off(hh);

SV *versv;
/* hh is a new copy for us to use; we are permitted to delete keys */
if((versv = hv_deletes(hh, "CORE/prevailing_version", 0)) && SvOK(versv)) {
SAVEI16(PL_prevailing_version);
PL_prevailing_version = SvUV(versv);
}

SvFLAGS(hh) = wasflags;
}
}
SAVECOMPILEWARNINGS();
Expand Down

0 comments on commit abc5e0f

Please sign in to comment.