diff options
author | Zefram <zefram@fysh.org> | 2010-01-15 17:13:17 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2010-01-15 17:14:17 +0100 |
commit | b6d1426f94a845fb8fece8b6ad0b7d9f35f2d62e (patch) | |
tree | 54fe1920392ae403777a861a34c9946a65685764 /pp.c | |
parent | 75080c809516a97a6560fd6463b6574c254662f7 (diff) | |
download | perl-b6d1426f94a845fb8fece8b6ad0b7d9f35f2d62e.tar.gz |
[perl #62646] Maximum string length with substr
(This is only a partial fix, since it doesn't handle lvalue substr)
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -3079,12 +3079,12 @@ PP(pp_substr) { dVAR; dSP; dTARGET; SV *sv; - I32 len = 0; + IV len = 0; STRLEN curlen; STRLEN utf8_curlen; - I32 pos; - I32 rem; - I32 fail; + IV pos; + IV rem; + IV fail; const I32 lvalue = PL_op->op_flags & OPf_MOD || LVRET; const char *tmps; const I32 arybase = CopARYBASE_get(PL_curcop); @@ -3147,7 +3147,7 @@ PP(pp_substr) rem = curlen; else if (len >= 0) { rem = pos+len; - if (rem > (I32)curlen) + if (rem > (IV)curlen) rem = curlen; } else { @@ -3167,8 +3167,8 @@ PP(pp_substr) RETPUSHUNDEF; } else { - const I32 upos = pos; - const I32 urem = rem; + const IV upos = pos; + const IV urem = rem; if (utf8_curlen) sv_pos_u2b(sv, &pos, &rem); tmps += pos; |