diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-01-22 22:48:42 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-01-23 10:19:35 -0800 |
commit | 6dd7c1f1e9477c302194505f6e1aaa57121f68bd (patch) | |
tree | 14b7b5596967043f012f2ad35f241a90d6a7ae4a /sv.c | |
parent | a9a249629c8a321606e6b817e73a8f8a2c0ae36f (diff) | |
download | perl-6dd7c1f1e9477c302194505f6e1aaa57121f68bd.tar.gz |
Don’t allow read-only regexps to be tied
Since the test triggered another bug in freeing read-only
regexps, this commit fixes that too.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -5310,7 +5310,7 @@ Perl_sv_magic(pTHX_ register SV *const sv, SV *const obj, const int how, if (SvREADONLY(sv)) { if ( /* its okay to attach magic to shared strings */ - (!SvFAKE(sv) || isGV_with_GP(sv)) + !SvIsCOW(sv) && IN_PERL_RUNTIME && !PERL_MAGIC_TYPE_READONLY_ACCEPTABLE(how) @@ -6191,7 +6191,7 @@ Perl_sv_clear(pTHX_ SV *const orig_sv) && !(SvTYPE(sv) == SVt_PVIO && !(IoFLAGS(sv) & IOf_FAKE_DIRP))) Safefree(SvPVX_mutable(sv)); - else if (SvPVX_const(sv) && SvREADONLY(sv) && SvFAKE(sv)) { + else if (SvPVX_const(sv) && SvIsCOW(sv)) { unshare_hek(SvSHARED_HEK_FROM_PV(SvPVX_const(sv))); SvFAKE_off(sv); } |