From: Mike Guy Date: Mon, 14 May 2001 16:12:22 +0000 (+0100) Subject: eval "format foo=" would loop indefinitely; reported in X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7121b3475484a520ee84b25696f18e1af9a30745;p=p5sagit%2Fp5-mst-13.2.git eval "format foo=" would loop indefinitely; reported in Subject: A load of old rubbish Message-Id: (The core dumps reported in there already fixed.) p4raw-id: //depot/perl@11510 --- diff --git a/toke.c b/toke.c index 68db086..d535442 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) {