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

scsynth: /b_read[Channel]: fix failure in sf_open caused by uninitialized memory #2793

Merged

Conversation

nhthn
Copy link
Contributor

@nhthn nhthn commented Mar 13, 2017

This fixes #2474, an uninitialized memory issue in /b_read and /b_readChannel which was causing nondeterministic failures in Buffer.cueSoundFile. libsndfile's sf_open takes as input a pointer to an SF_INFO struct, to which it writes its soundfile metadata. However, the SF_INFO struct's "format" parameter of the struct must be set to zero, otherwise (as best as I can tell from the sf_open docs) the audio is read in a raw format. Failure to initialize the SF_INFO memory is therefore a bad idea, and zeroing out the memory ensures that the raw format is not accidentally invoked.

Thanks to @Sciss and @bagong for helping to investigate this issue.

This fixes an uninitialized memory issue in /b_read and /b_readChannel, which was causing nondeterministic failures in Buffer.cueSoundFile. libsndfile's sf_open takes as input a pointer to an SF_INFO struct, to which it writes its soundfile metadata. However, the SF_INFO struct's "format" parameter of the struct must be set to zero, otherwise (as best as I can tell from the sf_open docs) the audio is read in a RAW format. Failure to initialize the SF_INFO memory is therefore a bad idea, and zeroing out the memory ensures that the RAW format is not accidentally invoked.
@vivid-synth
Copy link
Member

Nice work!

@vivid-synth vivid-synth merged commit 9ccc33c into supercollider:master Mar 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants