This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Push a new stack in sv_recode_to_utf8
authorFather Chrysostomos <sprout@cpan.org>
Sat, 23 Nov 2013 04:34:17 +0000 (20:34 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 23 Nov 2013 05:20:37 +0000 (21:20 -0800)
commit7a3f9604e7d1d54259d95737617eda679a3543ca
treedc608a0975669053a9829783a28d530c1e6f0ba8
parent148732bd2d927f02ceaf35fd3eb4ab0387c04552
Push a new stack in sv_recode_to_utf8

That prevents this from happening under STRESS_REALLOC:

$ ./perl -Ilib -Mencoding=johab -e '(chr(0x7f) eq "\x7f")'
Use of the encoding pragma is deprecated at -e line 0.
perl(3939) malloc: *** error for object 0x7fac20c03968: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

(That is an excerpt from t/uni/chr.t.)

It may also fix other instances of encoding.pm crashing, which I had
almost vowed not to do.  Oh well.

Constant folding is generally expected not to reallocate the stack,
because it should never need to extend it, just reduce the number of
items on it.

sv_recode_to_utf8 breaks that assumption.
sv.c