eval "format foo=" would loop indefinitely; reported in
Mike Guy [Mon, 14 May 2001 16:12:22 +0000 (17:12 +0100)]
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

toke.c

diff --git a/toke.c b/toke.c
index 68db086..d535442 100644 (file)
--- 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) {