summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorMike Guy <mjtg@cam.ac.uk>2001-05-14 17:12:22 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2001-07-31 02:13:58 +0000
commit7121b3475484a520ee84b25696f18e1af9a30745 (patch)
tree4419df4b09fc179567f133d1fd65afbd2cfcc913 /toke.c
parent74a6a946f443cceaa57e35bcb28c0276e02a0ae8 (diff)
downloadperl-7121b3475484a520ee84b25696f18e1af9a30745.tar.gz
eval "format foo=" would loop indefinitely; reported in
Subject: A load of old rubbish Message-Id: <E14zK1G-0003a2-00@virgo.cus.cam.ac.uk> (The core dumps reported in there already fixed.) p4raw-id: //depot/perl@11510
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/toke.c b/toke.c
index 68db0865f1..d535442fd9 100644
--- a/toke.c
+++ b/toke.c
@@ -7359,15 +7359,19 @@ S_scan_formline(pTHX_ register char *s)
if (*t == '@' || *t == '^')
needargs = TRUE;
}
- sv_catpvn(stuff, s, eol-s);
+ if (eol > s) {
+ sv_catpvn(stuff, s, eol-s);
#ifndef PERL_STRICT_CR
- if (eol-s > 1 && eol[-2] == '\r' && eol[-1] == '\n') {
- char *end = SvPVX(stuff) + SvCUR(stuff);
- end[-2] = '\n';
- end[-1] = '\0';
- SvCUR(stuff)--;
- }
+ if (eol-s > 1 && eol[-2] == '\r' && eol[-1] == '\n') {
+ char *end = SvPVX(stuff) + SvCUR(stuff);
+ end[-2] = '\n';
+ end[-1] = '\0';
+ SvCUR(stuff)--;
+ }
#endif
+ }
+ else
+ break;
}
s = eol;
if (PL_rsfp) {