diff options
author | SADAHIRO Tomoyuki <BQW10602@nifty.com> | 2004-04-29 19:53:17 +0900 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2004-04-29 18:30:18 +0000 |
commit | a67d7df96497dfc3914166c6fa65662e524a5bbb (patch) | |
tree | 3bfbccaf8360365f71de88b564b3b5378afd49d9 /sv.c | |
parent | 25a9bd2a66ab90bebdf152f1b70a957b5876ed63 (diff) | |
download | perl-a67d7df96497dfc3914166c6fa65662e524a5bbb.tar.gz |
Fix 29149 - another UTF8 cache bug hit by substr.
Regression test from:
Subject: Re: [perl #29149] substr/UTF8 related problem with perl 5.8.3 on linux
Message-Id: <20040429103926.5BA6.BQW10602@nifty.com>
Date: Thu, 29 Apr 2004 10:53:17 +0900
p4raw-id: //depot/perl@22755
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -6437,8 +6437,7 @@ Perl_sv_pos_u2b(pTHX_ register SV *sv, I32* offsetp, I32* lenp) s += UTF8SKIP(s); if (s >= send) s = send; - if (utf8_mg_pos_init(sv, &mg, &cache, 2, lenp, s, start)) - cache[2] += *offsetp; + utf8_mg_pos_init(sv, &mg, &cache, 2, lenp, s, start); } *lenp = s - start; } @@ -6531,6 +6530,11 @@ Perl_sv_pos_b2u(pTHX_ register SV* sv, I32* offsetp) cache[0] -= ubackw; *offsetp = cache[0]; + + /* Drop the stale "length" cache */ + cache[2] = 0; + cache[3] = 0; + return; } } @@ -6568,6 +6572,9 @@ Perl_sv_pos_b2u(pTHX_ register SV* sv, I32* offsetp) cache[0] = len; cache[1] = *offsetp; + /* Drop the stale "length" cache */ + cache[2] = 0; + cache[3] = 0; } *offsetp = len; |