This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #103260] Fix s/// with long strings
authorFather Chrysostomos <sprout@cpan.org>
Wed, 24 Dec 2014 04:12:06 +0000 (20:12 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 24 Dec 2014 04:13:11 +0000 (20:13 -0800)
commit3c6ef0a5332fe51f7e409d17fce0788646ee5bf6
treeaef0d1875f1be7015d2d5da1d5828e23aed44f7f
parent4bba85d0fdb428e77c7a589a992b892d7999bb33
[perl #103260] Fix s/// with long strings

This is also the subject of perl #123071.

The iteration count was stored in an I32 and was overflowing.  If the
maximum number of iterations possible overflowed, then it would become
negative, and the substitution would fail immediately with ‘Substitu-
tion loop’.

I tried fixing this without increasing the size of the context
stack entries on 64-bit builds (by skipping the loop check for long
strings), but was unable to, because we have to return the number of
iterations, which was also stored as I32.  If we change just that one
to SSize_t, we get an I32-sized alignment hole, so we might as well
make maxiters a SSize_t as well, fixing the bug that way (the more
straightforward way).
MANIFEST
cop.h
pp_ctl.c
pp_hot.c
t/bigmem/subst.t [new file with mode: 0644]