summaryrefslogtreecommitdiff
path: root/Src/input.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-03-25 14:03:40 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-03-25 14:03:40 +0000
commite71df91bd2cce6c06de8666fc04b695bae3c8f95 (patch)
tree3d9105e4b014f578302e344359cb1b2092932f81 /Src/input.c
parentc2fdffa316b8a67bc4bc61a0f5c68ecc27a68b6b (diff)
downloadzsh-e71df91bd2cce6c06de8666fc04b695bae3c8f95.tar.gz
zsh-e71df91bd2cce6c06de8666fc04b695bae3c8f95.zip
27827: fix infinite loop in recursive alias at end of parsed string
Diffstat (limited to 'Src/input.c')
-rw-r--r--Src/input.c21
1 files changed, 12 insertions, 9 deletions
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 ' ';