From: Jarkko Hietaniemi Date: Thu, 15 Mar 2001 01:05:01 +0000 (+0000) Subject: Avoid stomping off the beginning of an array in tr///. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ef38c078f0081ddde8564e6b309e7d682fca627a;p=p5sagit%2Fp5-mst-13.2.git Avoid stomping off the beginning of an array in tr///. p4raw-id: //depot/perl@9164 --- diff --git a/op.c b/op.c index 421dc9e..64914ea 100644 --- a/op.c +++ b/op.c @@ -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];