This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix a s/non-utf8/is-utf8/ bit of nastiness
authorDavid Mitchell <davem@iabyn.com>
Sun, 6 Feb 2011 19:48:34 +0000 (19:48 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sun, 6 Feb 2011 21:34:44 +0000 (21:34 +0000)
commitc95ca9b8cd1e9cb94201b96527b666a2e68bd781
treeab92c0c925828c7074e56e36f2947349af4d7387
parent33fb6f35374f797590a5f7df9532ead893676812
fix a s/non-utf8/is-utf8/ bit of nastiness

Commit 3e462cdc2087ddf90984010fabd80c30db92bfa0 provided a fix
for the  s/non-utf8/is-utf8/ case by upgrading TARG to UTF8 after the
match, but before the substitution. It used sv_utf8_upgrade() rather than
sv_utf8_upgrade_nomg(), so for example, with a tied variable, FETCH would
get called again, and all the char* pointers such as s would be left
dangling. If the length of the string was unchanged, the code wouldn't
notice this.

Fix by using the _nomg() variant, and by checking whether the string
has been reallocated
pp_hot.c
t/re/subst.t