summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-08-30 18:01:27 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-08-30 18:18:13 -0700
commit7d1328bb7c26d556809b1aed184cec377b18f20c (patch)
tree8b5067a3cef208222fda2304bf74c884f6bb8f8e /mg.c
parent4785469e43ed59eb07455c31ce1079ada2c9f91f (diff)
downloadperl-7d1328bb7c26d556809b1aed184cec377b18f20c.tar.gz
[perl #114410] Reset utf8 pos cache on get
If a scalar is gmagical, then the string buffer could change without the utf8 pos cache being updated. So it should respond to get-magic, not just set-magic. Actually add- ing get-magic to the utf8 magic vtable would cause all scalars with this magic to be flagged gmagical. Instead, in magic_get, we can call magic_setutf8.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mg.c b/mg.c
index 3972a87be6..089f9c6e26 100644
--- a/mg.c
+++ b/mg.c
@@ -213,6 +213,10 @@ Perl_mg_get(pTHX_ SV *sv)
if (mg->mg_flags & MGf_GSKIP)
(SSPTR(mgs_ix, MGS *))->mgs_magical = 0;
}
+ else if (vtbl == &PL_vtbl_utf8) {
+ /* get-magic can reallocate the PV */
+ magic_setutf8(sv, mg);
+ }
mg = nextmg;