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

Re: [PATCH] Don't segfault when uniquifying hidden tied arrays



On Mon, Jul 20, 2026 at 6:16 AM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>
> While pm->u.data is never NULL, the value assigned to x may be NULL but that's fine, then the code that follows simply does nothing; the function uniqarray immediately returns if its parameter is NULL.

The test case that fails if &nullarray is NOT returned by gsu.a->getfn is
  Running test: add array to empty parameter

With your patch:

Src/zsh -f
% setopt typesettounset
% typeset -T VAR var
% () { typeset -i var; typeset -g -U VAR }
% echo $VAR

% echo $+VAR
0
% () { typeset -i var; typeset -g -U VAR='a:a:b' }
% () { typeset -i var; typeset -g -U VAR='a:a:b'; typeset -p VAR }
zsh: bus error  Src/zsh -f

It crashes on "typeset -p" rather than on the assignment itself.
Without your patch, the above does not crash (but your original
example does).




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