hi juha ! sorry, but since i am leaving for holiday tomorrow, i will be able to solve your problems (hopefully) in the first september week.
hope, it is not too urgent. maybe you could have alook at the code yourself - seems like a memory allocation problem somehow.
mfg.ds.tzs IOhannes
On Thu, 16 Aug 2001, Juha Vehviläinen wrote:
hi,
i'm getting pd crashes, and it appears having to do with list2symbol, as the crashes disappear if I remove l2s from the patches. Any thoughts why this might be / found bugs lately?
I've found l2s to be essential.. at least I don't know another way of doing what it does!
cheers, as they say,
jusu~
Ok, I was able to trace and correct a memory bug in zexy's list2symbol, and the corrected list2symbol_bang looks like this:
(in z_strings.c)
----- clip ----- static void list2symbol_bang(t_list2symbol *x) { char *str=0, *s2; int n=0;
binbuf_gettext(x->bbuf, &str, &n);
// str[n]=0; // memory bug! s2 = malloc(n+1); strncpy(s2, str, n); s2[n]=0;
outlet_symbol(x->x_obj.ob_outlet, gensym(s2/*str*/)); freebytes(str, n); free(s2); } ----- clip -----
I'm no c expert, so I'm sure you'll make a similar, proper fix in the next zexy-patch...
It seems that binbuf_gettext() only allocs n bytes of memory for str, and doesn't put a \0 at the end, why so?
As I said, list2symbol is essential...
jusu
----- Original Message ----- From: "Johannes M Zmoelnig" zmoelnig@iem.kug.ac.at To: "Juha Vehviläinen" jusu@iki.fi Cc: pd-list@iem.kug.ac.at Sent: Thursday, August 16, 2001 10:16 PM Subject: Re: zexy list2symbol .. problem
maybe you could have alook at the code yourself - seems like a memory allocation problem somehow.
hi all! i am home again at last. funny thing about the list2symbol, because the bug was not reproducible for me under linux (but it crashed under NT). anyhow, i have put on a new version of zexy (being 1.1) on our ftp-server ftp://iem.kug.ac.at/pd/Externals/ZEXY the main udpate is indeed the bug-fixed Juha has done. thanks
mfg.dsa.sdt IOhannes
Juha Vehviläinen wrote:
Ok, I was able to trace and correct a memory bug in zexy's list2symbol, and the corrected list2symbol_bang looks like this:
(in z_strings.c)
----- clip ----- static void list2symbol_bang(t_list2symbol *x) { char *str=0, *s2; int n=0;
binbuf_gettext(x->bbuf, &str, &n);
// str[n]=0; // memory bug! s2 = malloc(n+1); strncpy(s2, str, n); s2[n]=0;
outlet_symbol(x->x_obj.ob_outlet, gensym(s2/*str*/)); freebytes(str, n); free(s2); } ----- clip -----
I'm no c expert, so I'm sure you'll make a similar, proper fix in the next zexy-patch...
It seems that binbuf_gettext() only allocs n bytes of memory for str, and doesn't put a \0 at the end, why so?
As I said, list2symbol is essential...