diff options
author | Zefram <zefram@fysh.org> | 2010-04-14 09:29:15 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2010-04-14 09:29:15 +0200 |
commit | 255fdf19250671082618dae106a246f12379dbe6 (patch) | |
tree | f19d65ed1133ce03e5bb96cc8937c1f6d1e7fa44 /toke.c | |
parent | bd2aeadfa5cb8ea8dbfc9c3060728594d8452bc6 (diff) | |
download | perl-255fdf19250671082618dae106a246f12379dbe6.tar.gz |
[perl #74006] 5.12.0-RC stuffing bug
There's a small bug in lex_stuff_pvn() that causes spurious syntax errors
in an obscure situation. It happens if stuffing is performed on the
last line of a file, and the line ends with a statement that lacks its
terminating semicolon. Attached patch fixes and adds test.
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -956,6 +956,8 @@ Perl_lex_stuff_pvn(pTHX_ char *pv, STRLEN len, U32 flags) lex_grow_linestr(SvCUR(PL_parser->linestr)+1+len+highhalf); bufptr = PL_parser->bufptr; Move(bufptr, bufptr+len+highhalf, PL_parser->bufend+1-bufptr, char); + SvCUR_set(PL_parser->linestr, + SvCUR(PL_parser->linestr) + len+highhalf); PL_parser->bufend += len+highhalf; for (p = pv; p != e; p++) { U8 c = (U8)*p; @@ -994,6 +996,8 @@ Perl_lex_stuff_pvn(pTHX_ char *pv, STRLEN len, U32 flags) lex_grow_linestr(SvCUR(PL_parser->linestr)+1+len-highhalf); bufptr = PL_parser->bufptr; Move(bufptr, bufptr+len-highhalf, PL_parser->bufend+1-bufptr, char); + SvCUR_set(PL_parser->linestr, + SvCUR(PL_parser->linestr) + len-highhalf); PL_parser->bufend += len-highhalf; for (p = pv; p != e; p++) { U8 c = (U8)*p; @@ -1009,6 +1013,7 @@ Perl_lex_stuff_pvn(pTHX_ char *pv, STRLEN len, U32 flags) lex_grow_linestr(SvCUR(PL_parser->linestr)+1+len); bufptr = PL_parser->bufptr; Move(bufptr, bufptr+len, PL_parser->bufend+1-bufptr, char); + SvCUR_set(PL_parser->linestr, SvCUR(PL_parser->linestr) + len); PL_parser->bufend += len; Copy(pv, bufptr, len, char); } |