Problem: osc responder crashes sclang on recieving a string larger than 255.
Reason: This is due to the fact that an incoming string is converted
into a Symbol by sclang. When creating a symbol from a string, the
string normally is truncated to 255 characters. Seemingly the
attempt to create a symbol larger than this causes the sclang to
crash.
// the problem is in PyrObject* ConvertOSCMessage(int inSize, char *inData):
case 's' :
SetSymbol(slots+i+1, getsym(msg.gets()));
//post("sym '%s'\n", slots[i+1].us->name);
break;
// I have fixed it as follows:
inchars = msg.gets();
size = strlen(inchars);
if(size < 256) {
SetSymbol(slots+i+1, getsym(inchars));
} else {
PyrString *strobj = newPyrStringN(g->gc,
size, 0, true);
memcpy(strobj->s, inchars, size);
SetObject(slots+i+1, strobj);
}
// ok to commit ?