Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH (4.0.x, 4.1.x): Re: Core dump bug in ZSH version 3.0.7



[ Hi, folks! ]

Bart wrote:

> On Nov 12,  6:59pm, Bart Schaefer wrote:
> } Subject: Re: Core dump bug in ZSH version 3.0.7
> }
> } It doesn't crash 4.0.x/4.1.x, but it does get into a rather 
> strange state,
> } trying to read a here-document whose start/end string is a 
> single space,
> } which of course is impossible (so you're trapped in the 
> here-document until
> } you interrupt somehow).
> } 
> } zagzig% mask = (1 << string.atoi(sys.argv[1])) - 1
> } zsh: parse error near `)'
> 
> At this point we've parsed this as the command "mask" with 
> arguments "="
> and "(1" and with here-document ending at 
> "string.atoi(sys.argv[1])"; the
> parse error is at the second parenthesis.
> 
> However, when zsh bailed out with the parse error, it failed 
> to pop the
> pending here-document off the queue of such documents. 

Exactly.

> So 
> then when it
> begins parsing this:
> 
> } zagzig% key = string.atoi(sys.argv[2])
> } heredoc>  

(Actually, just hitting Return shows the bug - the prompt changes from normal
to `heredoc', whew.)

>  	    return 0;
>  	}
>  	yyerror(1);
> +	while (hdocs) {
> +	    struct heredocs *next = hdocs->next;
> +	    zfree(hdocs, sizeof(struct heredocs));
> +	    hdocs = next;
> +	}
>  	herrflush();
>  	if (noerrs != 2)
>  	    errflag = 1;

I built a similar patch yesterday evening, but then forgot to bring it
with me today. (I'm terribly net-handicapped at the moment, because I'm
behind a fiendish firewall in a disgusting Windows-net here and don't
have my Unix-box yet, so I couldn't commit the change myself anyway.)

My change put that cleanup-loop in a separate function, though, and made
that function be called anywhere where we call bld_eprog() (if (success)),
just to make sure...

Bye
  Sven

P.S.: My other computer will be put into a different net here so I hope to
      be able to participate again when it arrives. Also, my E-mail address
      will be wischnow@xxxxxxxxx, not the one above (the berkom-address is
      already functional, forwarded telekom.de).



Messages sorted by: Reverse Date, Date, Thread, Author