You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code implements seeking for WAV, FLAC and MP3 on the . This also fixes looping on those three file types when enabled.
By looking on the offset code on OGG (with stb_vorbis_get_sample_offset), I am not sure if it's required on dr* libraries as it doesn't seem to jump to a different PCM, I guess stb_vorbis_get_sample_offsets gets the position that we seek?
@jarikomppa
This PR actually fixes a pretty serious memory corruption issue i was facing in my project.
I traced this bug down with valgrind, where this exact function (WavStreamInstance::seek) was always the root-cause of invalid memory writes.
Before, this code only checked for mCodec.mOgg != nullptr and then assumed that the codec is ogg-vorbis.
However mCodec is a union, so every type (including wave) will have mCodec.mOgg set.
This causes stb_vorbis_get_sample_offset (treating *mWav's value as *mOgg) to write to arbitrary memory, which in my case lead to a crash.
Writes where also wide-spread, since the struct contains channel- and sample-counts which potentially became pretty large numbers.
After applying this patch, all other related OOB writes also vanished. #279 seems to be related to this, since i got the exact same behaviour of null-pointers in that array.
This stopped too after that change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The following code implements seeking for WAV, FLAC and MP3 on the . This also fixes looping on those three file types when enabled.
By looking on the offset code on OGG (with stb_vorbis_get_sample_offset), I am not sure if it's required on dr* libraries as it doesn't seem to jump to a different PCM, I guess stb_vorbis_get_sample_offsets gets the position that we seek?