summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-12-23 20:12:06 -0800
committerFather Chrysostomos <sprout@cpan.org>2014-12-23 20:13:11 -0800
commit3c6ef0a5332fe51f7e409d17fce0788646ee5bf6 (patch)
treeaef0d1875f1be7015d2d5da1d5828e23aed44f7f /cop.h
parent4bba85d0fdb428e77c7a589a992b892d7999bb33 (diff)
downloadperl-3c6ef0a5332fe51f7e409d17fce0788646ee5bf6.tar.gz
[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).
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/cop.h b/cop.h
index 9c25555d95..ec3e32f8d4 100644
--- a/cop.h
+++ b/cop.h
@@ -882,9 +882,9 @@ struct subst {
U8 sbu_type; /* what kind of context this is */
U8 sbu_rflags;
U16 sbu_rxtainted; /* matches struct block */
- I32 sbu_iters;
- I32 sbu_maxiters;
I32 sbu_oldsave;
+ SSize_t sbu_iters;
+ SSize_t sbu_maxiters;
char * sbu_orig;
SV * sbu_dstr;
SV * sbu_targ;