diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-03-15 01:05:01 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-03-15 01:05:01 +0000 |
commit | ef38c078f0081ddde8564e6b309e7d682fca627a (patch) | |
tree | f667c2d3c3f7d1d4c1d2534658710fd5c4dc24b7 /op.c | |
parent | fc865b05a6e46dfadc1934cb061c1ccca0958ef7 (diff) | |
download | perl-ef38c078f0081ddde8564e6b309e7d682fca627a.tar.gz |
Avoid stomping off the beginning of an array in tr///.
p4raw-id: //depot/perl@9164
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -2872,11 +2872,8 @@ Perl_pmtrans(pTHX_ OP *o, OP *expr, OP *repl) } } } - if (!del) { - if (j >= rlen) - j = rlen - 1; - else - cPVOPo->op_pv = (char*)Renew(tbl, 0x101+rlen-j, short); + if (!del && rlen >= j) { + cPVOPo->op_pv = (char*)Renew(tbl, 0x101+rlen-j, short); tbl[0x100] = rlen - j; for (i=0; i < rlen - j; i++) tbl[0x101+i] = r[j+i]; |