1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-05-17 13:36:04 +02:00

52556: fix crash when changing type of unset referent via named reference

This commit is contained in:
Bart Schaefer 2024-02-17 20:27:56 -08:00
parent 74722b8d4e
commit 8c59638522
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2024-02-17 Bart Schaefer <schaefer@zsh.org>
* 52556: Src/builtin.c: fix crash when applying a type change via
a named reference when the referent has been declared but unset
2024-02-16 Mikael Magnusson <mikachu@gmail.com>
* 52546: Functions/Zle/incarg: incarg: avoid unneeded subshell

View File

@ -2031,8 +2031,10 @@ typeset_single(char *cname, char *pname, Param pm, int func,
char *subscript;
if (pm && (pm->node.flags & PM_NAMEREF) && !((off|on) & PM_NAMEREF)) {
if (!(off & PM_NAMEREF))
pm = (Param)resolve_nameref(pm, NULL);
if (!(off & PM_NAMEREF)) {
if ((pm = (Param)resolve_nameref(pm, NULL)))
pname = pm->node.nam;
}
if (pm && (pm->node.flags & PM_NAMEREF) &&
(on & ~(PM_NAMEREF|PM_LOCAL|PM_READONLY))) {
/* Changing type of PM_SPECIAL|PM_AUTOLOAD is a fatal error. *