Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classlib: MIDISysexDispatcher keys must be an array, not a large integer #3005

Merged
merged 1 commit into from
Jun 29, 2017

Conversation

jamshark70
Copy link
Contributor

getKeysForFuncProxy should always return a collection, because of where it's used:

https://github.com/supercollider/supercollider/blob/master/SCClassLibrary/Common/Control/ResponseDefs.sc#L131-L132

		keys = this.getKeysForFuncProxy(funcProxy);
		keys.do({|key| active[key] = active[key].addFunc(func) }); // support multiple keys

All of the other MIDI***Dispatcher classes do asArray in getKeysForFuncProxy... MIDISysexDispatcher, uniquely, does not:

	getKeysForFuncProxy {|funcProxy| ^(funcProxy.srcID ? \all)}

So, when the srcID is a very large integer, keys becomes a large integer, and then keys.do will add a new item into active that number of times. Millions of times. Potentially-crashy numbers of times.

Fixes #2937.

@jamshark70 jamshark70 added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: class library SC class library crash things which cause a crash in the interpreter, servers, or IDE. do not use for PRs labels Jun 29, 2017
@jamshark70 jamshark70 force-pushed the topic/SysexMemoryFix branch from 20228d3 to 9460782 Compare June 29, 2017 02:11
@jamshark70
Copy link
Contributor Author

Amended: Initially I did [ ... ] to make the array, but I think asArray covers more cases.

@nhthn nhthn added this to the 3.9 milestone Jun 29, 2017
@mossheim
Copy link
Contributor

Tested and works, thx

@mossheim mossheim merged commit 8198f17 into supercollider:master Jun 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: class library SC class library crash things which cause a crash in the interpreter, servers, or IDE. do not use for PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants