-
Notifications
You must be signed in to change notification settings - Fork 23
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
Null reference / UB when attempting to play audio #41
Comments
Good news, everyone! The true source of the bug is my own stupidity: it looks like the Still - is it worth putting a check on the pointer de-reference? Or a note about safety? |
Rodrigodd
added a commit
to Rodrigodd/audio-engine
that referenced
this issue
Aug 18, 2022
Droping cpal Stream is unsound in android, see: katyo/oboe-rs#41
Rodrigodd
added a commit
to Rodrigodd/oboe-rs
that referenced
this issue
Aug 26, 2022
This mainly fix issue katyo#41, that causes crashes when a `AudioStream` was drop. That happen because the `AudioStream` was not closed on Drop, but was deleted, causing a use-after-free by the not closed `onDataCallback` thread. Also, the method `AudioStreamBuilder::open_stream` was using the deprecated method `openStream(AudioStream*)`, that do not allow deleting the `AudioStream` safely. Replaced it by `openStream(shared_ptr<AudioStream>)`. The deprecated function allowed a use-after-free by the `onErrorCallback` thread. Also, as noted by issue katyo#45, the bindings for `AudioStream::close()` was wrongly bound to the concrete implementation of the base class, instead of calling the virtual method. Also note that currently there is no safe way to delete the `onErrorCallback` of a `AudioStream` in oboe (see google/oboe#1610), so instead the current implementation leaks the callback on drop. Also, remove some unsound `Drop` implementations and replace them by explicit unsafe delete methods.
katyo
pushed a commit
that referenced
this issue
Jan 17, 2023
This mainly fix issue #41, that causes crashes when a `AudioStream` was drop. That happen because the `AudioStream` was not closed on Drop, but was deleted, causing a use-after-free by the not closed `onDataCallback` thread. Also, the method `AudioStreamBuilder::open_stream` was using the deprecated method `openStream(AudioStream*)`, that do not allow deleting the `AudioStream` safely. Replaced it by `openStream(shared_ptr<AudioStream>)`. The deprecated function allowed a use-after-free by the `onErrorCallback` thread. Also, as noted by issue #45, the bindings for `AudioStream::close()` was wrongly bound to the concrete implementation of the base class, instead of calling the virtual method. Also note that currently there is no safe way to delete the `onErrorCallback` of a `AudioStream` in oboe (see google/oboe#1610), so instead the current implementation leaks the callback on drop. Also, remove some unsound `Drop` implementations and replace them by explicit unsafe delete methods.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there! Thanks so much for all your hard work building this library. :)
Unfortunately I'm having an intermittent issue where attempting to play audio on the Oculus Quest 2. I've filed an issue with
cpal
RustAudio/cpal#636 but it appears that the root cause is a null pointer dereference inoboe::AudioStream::getTimestamp(int)
.Here's the log output from oboe:
And the final crash:
As I'm fairly new to audio in general I'm not quite sure where else I should be looking. Please let me know if there's any further details I can provide!
The text was updated successfully, but these errors were encountered: