From e71df91bd2cce6c06de8666fc04b695bae3c8f95 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 25 Mar 2010 14:03:40 +0000 Subject: 27827: fix infinite loop in recursive alias at end of parsed string --- Src/input.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'Src') diff --git a/Src/input.c b/Src/input.c index 248d2ae71..0e802da62 100644 --- a/Src/input.c +++ b/Src/input.c @@ -195,21 +195,24 @@ ingetc(void) return lastc; } - /* If the next element down the input stack is a continuation of - * this, use it. - */ - if (inbufflags & INP_CONT) { - inpoptop(); - continue; - } /* - * Otherwise, see if we have reached the end of input + * See if we have reached the end of input * (due to an error, or to reading from a single string). + * Check the remaining characters left, since if there aren't + * any we don't want to pop the stack---it'll mark any aliases + * as not in use before we've finished processing. */ - if (strin || errflag) { + if (!inbufct && (strin || errflag)) { lexstop = 1; return ' '; } + /* If the next element down the input stack is a continuation of + * this, use it. + */ + if (inbufflags & INP_CONT) { + inpoptop(); + continue; + } /* As a last resort, get some more input */ if (inputline()) return ' '; -- cgit 1.4.1