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

Re: PATCH: seg fault resulting from parameter unset code



I wrote:
> 
> The problem is that when the integer is unset as part of the array
> assignment by stdunsetfn(), the value (pm->u) is not set to the null
> pointer. Later when the array is set, it attempts to free any existing
> array. pm->u.arr is going to be 4 casted to a pointer and it tries to
> free it.

Except I didn't account for specials. In their case, pm->u shouldn't
be messed with.

Hopefully, this is now right.

Oliver

Index: params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.57
diff -u -r1.57 params.c
--- params.c    2001/12/18 09:16:20     1.57
+++ params.c    2001/12/18 14:35:38
@@ -2286,7 +2286,10 @@
        case PM_SCALAR: pm->sets.cfn(pm, NULL); break;
        case PM_ARRAY:  pm->sets.afn(pm, NULL); break;
        case PM_HASHED: pm->sets.hfn(pm, NULL); break;
-       default: pm->u.str = NULL; break;
+       default:
+           if (!(pm->flags & PM_SPECIAL))
+               pm->u.str = NULL;
+           break;
     }
     pm->flags |= PM_UNSET;
 }

_____________________________________________________________________
This message has been checked for all known viruses by the 
MessageLabs Virus Scanning Service. For further information visit
http://www.messagelabs.com/stats.asp



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