diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-08-30 18:01:27 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-08-30 18:18:13 -0700 |
commit | 7d1328bb7c26d556809b1aed184cec377b18f20c (patch) | |
tree | 8b5067a3cef208222fda2304bf74c884f6bb8f8e /mg.c | |
parent | 4785469e43ed59eb07455c31ce1079ada2c9f91f (diff) | |
download | perl-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.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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; |