perl/perl-saverecontext.diff
Stephan Kulow bcc016af5d - update to perl-5.26.1
* [CVE-2017-12837] Heap buffer overflow in regular expression compiler
 * [CVE-2017-12883] Buffer over-read in regular expression parser
 * tons of bug fixes
- update list of obsoletes

OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl?expand=0&rev=152
2017-09-23 12:12:52 +00:00

29 lines
855 B
Diff

Index: regcomp.c
===================================================================
--- regcomp.c.orig
+++ regcomp.c
@@ -19959,8 +19959,21 @@ Perl_save_re_context(pTHX)
if (gvp) {
GV * const gv = *gvp;
- if (SvTYPE(gv) == SVt_PVGV && GvSV(gv))
- save_scalar(gv);
+ if (SvTYPE(gv) == SVt_PVGV && GvSV(gv)) {
+ /* this is a copy of save_scalar() without the GETMAGIC call, RT#76538 */
+ SV ** const sptr = &GvSVn(gv);
+ SV * osv = *sptr;
+ SV * nsv = newSV(0);
+ save_pushptrptr(SvREFCNT_inc_simple(gv), SvREFCNT_inc(osv), SAVEt_SV);
+ if (SvTYPE(osv) >= SVt_PVMG && SvMAGIC(osv)) {
+ if (SvGMAGICAL(osv)) {
+ SvFLAGS(osv) |= (SvFLAGS(osv) &
+ (SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT;
+ }
+ mg_localize(osv, nsv, (bool)1);
+ }
+ *sptr = nsv;
+ }
}
}
}