Revision: 9112
http://supercollider.svn.sourceforge.net/supercollider/?rev=9112&view=revAuthor: thelych
Date: 2009-04-23 13:31:18 +0000 (Thu, 23 Apr 2009)
Log Message:
-----------
fixing bad PyrObject array allocation and possible index overflow in [SCCocoaToLangAction forwardInvocation:] method
Modified Paths:
--------------
trunk/Source/app/CocoaBridgePrimitives.M
Modified: trunk/Source/app/CocoaBridgePrimitives.M
===================================================================
--- trunk/Source/app/CocoaBridgePrimitives.M 2009-04-23 12:41:38 UTC (rev 9111)
+++ trunk/Source/app/CocoaBridgePrimitives.M 2009-04-23 13:31:18 UTC (rev 9112)
@@ -622,7 +622,7 @@
//post("trying %s ", sel_getName(sel));
NSEnumerator *e = [mSelectorArray keyEnumerator];
NSNumber* obj=nil;
- while(obj = (NSNumber*)[e nextObject]) {
+ while( (obj = (NSNumber*)[e nextObject]) ) {
SEL thesel = (SEL)[obj longValue];
if(sel == thesel) {
return YES;
@@ -660,15 +660,16 @@
PyrObject* array;
PyrObjectHdr* pyrObject;
- array = newPyrArray(g->gc, 2, 0, true);
+ //array = newPyrArray(g->gc, 2, 0, true);
+ array = ::instantiateObject(g->gc, s_array->u.classobj, maxArgs-2, true, true);
SetObject(g->sp, array);
- for(unsigned int i=2; i < maxArgs; ++i) {
+ PyrSlot* slots = array->slots;
+ for(int i=2; i < maxArgs; ++i) {
[inv getArgument:(void*)&value atIndex:i];
- ObjcTypeFillPyrSlot(array->slots + array->size, [nsSignature getArgumentTypeAtIndex:i], (void*)&value, &pyrObject);
+ ObjcTypeFillPyrSlot(slots++, [nsSignature getArgumentTypeAtIndex:i], (void*)&value, &pyrObject);
if(pyrObject)
g->gc->GCWrite(array, pyrObject);
- array->size++;
}
}
else
@@ -1723,7 +1724,7 @@
COCOABRIDGE_OBJ_RELEASE(nsobj);
receiver->uo->slots[0].ui = nil;
}else
- post("SCNSObject object pointer is nil");
+ post("SCNSObject object pointer is nil\n");
return errNone;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
_______________________________________________
sc-dev mailing list
info (subscription, etc.):
http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtmlarchive:
http://www.listarc.bham.ac.uk/marchives/sc-dev/search:
http://www.listarc.bham.ac.uk/lists/sc-dev/search/