Hi,
a friend brought to my attention, that dumpOSC doesn't handle lists
with more than 50 elements properly. It simply crahes Pd. Attached
patch shows this. (pd 0.39 required for "list").
The reason actually is quite simple: dumpOSC.c defines a maximum of
atoms to hold in x->x_outat of being 50 as default, but later doesn't
check at all, if this space is exceeded. Here's the relevant part of
the struct declaration:
/* ----------------------------- dumpOSC ------------------------- */
#define MAXOUTAT 20
static t_class *dumpOSC_class;
typedef struct _dumpOSC
{
t_object x_obj;
t_outlet *x_msgout;
t_outlet *x_connectout;
t_atom x_outat[MAXOUTAT];
int x_outatc;
/* ... */
} t_dumpOSC;
Then later in the functions "dumpOSC_PrintTypeTaggedArgs" and
"dumpOSC_PrintHeuristicallyTypeGuessedArgs" x->x_outat is happily
filled with atoms as long as the incoming message list lasts, which of
course is a recipe for desaster.
Now with my limited experience in C coding, I wonder, what's the best
way to fix this.
I already wrapped all tries to append to x->x_outat in a big "if"
clause which checks, if MAXOUTAT is reached. This works and keeps Pd
from crashing. However somehow it doesn't feel right to just truncate
the incoming message, even when posting a big warning message. OTOH I
suppose, that declaring *x_outat with a fixed size was done for speed
reasons. Having to allocate memory everytime a message comes in would
be very slow.
Maybe one could introduce an argument to dumpOSC which sets the
maximum allowed message length (with a default of 50)?
So what to do about this? Any advice or opinions? (Apart from using
liblo and totally rewriting OSCx, which of course probably is the best
solution ...)
Ciao
--
Frank Barknecht _ ______footils.org_ __goto10.org__