diff options
author | Graham Barr <gbarr@pobox.com> | 2003-10-29 09:56:53 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2004-02-29 16:21:34 +0000 |
commit | b76f3ce2ec5581029cdf9bb8f9a8cc61fe6afee0 (patch) | |
tree | d8563c6e37fc17839b79e6d2f0abe57ed07b6682 /mg.c | |
parent | 86a3586d2f6fdc0e0bf0032bcc374d9ac7dc2eb9 (diff) | |
download | perl-b76f3ce2ec5581029cdf9bb8f9a8cc61fe6afee0.tar.gz |
Re: [perl #24346] pulling in stuff from outside the substr lvalue
Message-Id: <3993BF6C-09F6-11D8-B6DD-0003938857CC@pobox.com>
make a variable aliased to an lvalue substr value work as expected
p4raw-id: //depot/perl@22414
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1780,16 +1780,21 @@ Perl_magic_setsubstr(pTHX_ SV *sv, MAGIC *mg) sv_utf8_upgrade(lsv); sv_pos_u2b(lsv, &lvoff, &lvlen); sv_insert(lsv, lvoff, lvlen, tmps, len); + LvTARGLEN(sv) = sv_len_utf8(sv); SvUTF8_on(lsv); } else if (lsv && SvUTF8(lsv)) { sv_pos_u2b(lsv, &lvoff, &lvlen); + LvTARGLEN(sv) = len; tmps = (char*)bytes_to_utf8((U8*)tmps, &len); sv_insert(lsv, lvoff, lvlen, tmps, len); Safefree(tmps); } - else - sv_insert(lsv, lvoff, lvlen, tmps, len); + else { + sv_insert(lsv, lvoff, lvlen, tmps, len); + LvTARGLEN(sv) = len; + } + return 0; } |