This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Copy RE capture buf on overload as well as TEMP
authorDavid Mitchell <davem@iabyn.com>
Wed, 1 Sep 2010 15:59:03 +0000 (16:59 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 1 Sep 2010 16:08:46 +0000 (17:08 +0100)
commitf427b557f0f598ee6ff57dfc24080cf33d959242
tree823b0b103416760b33d52b0131662d394bae3034
parent8ebb9810247974cb36d9fc84f30cf667c36e141e
Copy RE capture buf on overload as well as TEMP

Partial fix for [perl #77084]. Sometimes pp_match makes a copy of the
original SV's string for the later use of $1 et al; in particular if the
SV is TEMP (so will soon go away).

Make it do the same if the SV is overloaded, as the string return is most
certainly temporary!

(Also tweak the tests to make them more likely to fail on badness by
creating new stings that will likely reallocate freed buffer).
pp_hot.c
t/re/overload.t