diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-12-28 23:57:05 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-12-28 23:57:05 +0000 |
commit | 792b2c1636f29e9c8ddbd03dbcee9083ba541eed (patch) | |
tree | 066374057fb99366c534c1b73a8dee54f1c6eb77 /pp_hot.c | |
parent | 2269b42e02cee8680b0b9ff4923a5a9c3f8df482 (diff) | |
download | perl-792b2c1636f29e9c8ddbd03dbcee9083ba541eed.tar.gz |
The maxiters upper limit sanity check (guarding against
non-progress) assumed bytes instead of characters in s///
and split().
p4raw-id: //depot/perl@8245
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1821,6 +1821,8 @@ PP(pp_subst) STRLEN len; int force_on_match = 0; I32 oldsave = PL_savestack_ix; + bool do_utf8; + STRLEN slen; /* known replacement string? */ dstr = (pm->op_pmflags & PMf_CONST) ? POPs : Nullsv; @@ -1831,6 +1833,7 @@ PP(pp_subst) EXTEND(SP,1); } PL_reg_sv = TARG; + do_utf8 = DO_UTF8(PL_reg_sv); if (SvFAKE(TARG) && SvREADONLY(TARG)) sv_force_normal(TARG); if (SvREADONLY(TARG) @@ -1853,9 +1856,10 @@ PP(pp_subst) DIE(aTHX_ "panic: pp_subst"); strend = s + len; - maxiters = 2*(strend - s) + 10; /* We can match twice at each - position, once with zero-length, - second time with non-zero. */ + slen = do_utf8 ? utf8_length(s, strend) : len; + maxiters = 2 * slen + 10; /* We can match twice at each + position, once with zero-length, + second time with non-zero. */ if (!rx->prelen && PL_curpm) { pm = PL_curpm; |