summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-02-07 12:19:17 +0000
committerNicholas Clark <nick@ccl4.org>2006-02-07 12:19:17 +0000
commita2b7337b02f836aab62591af0d79675c5d157499 (patch)
treec61fa2f9f19af6204bd963d72d2d5448b8bda68c /pp.c
parent7acbb8ec149b2b0481081c92fe4351d46ae0ae3a (diff)
downloadperl-a2b7337b02f836aab62591af0d79675c5d157499.tar.gz
Fix bug 38454 (rindex corrects for $[ on bytes rather than UTF-8)
p4raw-id: //depot/perl@27116
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pp.c b/pp.c
index e9f159b19d..ee32dbacba 100644
--- a/pp.c
+++ b/pp.c
@@ -3239,9 +3239,13 @@ PP(pp_rindex)
if (MAXARG < 3)
offset = blen;
else {
+ /* arybase is in characters, like offset, so combine prior to the
+ UTF-8 to bytes calculation. */
+ offset -= arybase;
if (offset > 0 && big_utf8)
sv_pos_u2b(big, &offset, 0);
- offset = offset - arybase + llen;
+ /* llen is in bytes. */
+ offset += llen;
}
if (offset < 0)
offset = 0;