summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-11-13 19:07:09 +0100
committerNicholas Clark <nick@ccl4.org>2011-11-13 19:07:09 +0100
commit37555a72adecf94648131869556fee88f171a85e (patch)
tree2de33b25d719918413437673efbf3cbbfb64cbb0
parenta35dcc95dd24524931ea1c7900ae466ce7c2c255 (diff)
downloadperl-37555a72adecf94648131869556fee88f171a85e.tar.gz
In Perl_lex_start(), don't read the byte before SvPVX().
If len is 0, we shouldn't be reading from len - 1, as it's one before the start of the buffer, and hence an out of bounds read. Fixes a bug inadvertently added by commit 0abcdfa4c5da571f, restoring the previous behaviour for the len == 0 case.
-rw-r--r--toke.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index aec710176d..33d7b86fdb 100644
--- a/toke.c
+++ b/toke.c
@@ -728,7 +728,7 @@ Perl_lex_start(pTHX_ SV *line, PerlIO *rsfp, U32 flags)
parser->linestr = flags & LEX_START_COPIED
? SvREFCNT_inc_simple_NN(line)
: newSVpvn_flags(s, len, SvUTF8(line));
- if (s[len-1] != ';')
+ if (!len || s[len-1] != ';')
sv_catpvs(parser->linestr, "\n;");
} else {
parser->linestr = newSVpvs("\n;");