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

Re: [PATCH] jp: fix segfaults during parameter expansion



On Sun, Jan 14, 2018 at 04:06:09AM -0800, Bart Schaefer wrote:
>
> Thanks for tracking this down.  Defensive programming is always good,
> but I think this is indicative of a problem further upstream.
> 
> What's the expected output of that substitution?

No problem; to be quite honestly I don't think there is on, haha.
Okdana on irc pointed it out, and I just tracked it down cause
tracking down stuff like this is something I enjoy. When I found the
NULL dereferences it made me wonder "wtf is going on here anyway???" so
I asked:

> 20:30 <jp> also how in the fuck did you even find this
> 20:30 <jp> this is like something a fuzzer would pop out
> 20:30 <okdana> lol
> 20:31 <okdana> i was trying to assign a value to an association element
>       through indirection
> 20:31 <okdana> the AA is nonsense because a single element can't have an
>        array/association assigned to it obv
> 20:32 <okdana> i was just adding and removing stuff randomly to see what
>       would work

so yeah :) Honestly, I mostly just wasn't comfortable with paramater
expansion segfaulting, heh.

On Sun, Jan 14, 2018 at 04:06:09AM -0800, Bart Schaefer wrote:
> 
> The following prevents the segfault for me, instead giving the error
> "zsh: not an identifier: " (i.e., empty string is not a valid
> parameter name).  But perhaps there's a different error that should
> occur here if val is NULL?

That actually helped me realize (imo) a simpler solution; working
on a [PATCH v2] right now.

-- 
Joey Pabalinas

Attachment: signature.asc
Description: PGP signature



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