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

Re: [BUG] Crash when accessing WIDGETSTYLE from SIGINT trap



On Mon, 2019-11-11 at 16:40 +0100, Roman Perepelitsa wrote:
> On Mon, Nov 11, 2019 at 3:58 PM Peter Stephenson
> <p.stephenson@xxxxxxxxxxx> wrote:
> > 
> > 
> > On Mon, 2019-11-11 at 15:38 +0100, Roman Perepelitsa wrote:
> > > 
> > > Crash at zle_params.c:436 due to bindk being null:
> > > 
> > >     Widget widget = bindk->widget;
> > Looks to me like returning the empty string in that case would be fine?
> I don't know. I haven't sent a patch because I'm not sure whether the
> fix should be right there in get_widgetstyle or somewhere earlier so
> that bindk is not null to begin with.

I think there are highly likely to be such cases.  Look in zlecore()
where bindk is set.  We test for bindk NULL there after reading it.
You've got an asynchronous event so you don't know where that's going to
happen.  (There's a good chance signals are actually blocked at *that*
point, I didn't follow that through, but this is just an example.)

The only alternative I can think of would be queuing signals in more
places, but that's quite a heavyweight change that requires a good deal
of thinking through.  I think a NULL check in both places is entirely
unobjectionable.

(That doesn't mean everything else is *ncessarily* great, obviously...)

pws



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