From eaf7e88fef6975b1ed0126a8c819540f761cf002 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sun, 23 Jun 2013 14:38:32 -0700 Subject: [PATCH] sv.c: Allow COWs through sv_magic unscathed MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit There is no need to run COWs through sv_force_normal when attaching magic to them via sv_magic. (I don’t know about PERL_OLD_COPY_ON_WRITE, but I left it in, just to be sure.) Before this, only sv_magicext could attach magic to SVs that were already COWs. That meant pos($cow)=7 would leave it as a COW, but copy-on-write would never happen with tainted strings. --- sv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sv.c b/sv.c index 81db766..cc93089 100644 --- a/sv.c +++ b/sv.c @@ -5436,7 +5436,7 @@ Perl_sv_magic(pTHX_ SV *const sv, SV *const obj, const int how, vtable = (vtable_index == magic_vtable_max) ? NULL : PL_magic_vtables + vtable_index; -#ifdef PERL_ANY_COW +#ifdef PERL_OLD_COPY_ON_WRITE if (SvIsCOW(sv)) sv_force_normal_flags(sv, 0); #endif -- 2.7.4