-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Stream callback procedure is not unwind safe #20
Comments
BartMassey
added a commit
to BartMassey-upstream/portaudio-rs
that referenced
this issue
May 13, 2020
Two uses of mem::forget() after user callbacks were replaced with Box::leak() before the user callbacks to ensure that unowned memory was not improperly freed on panic.
BartMassey
added a commit
to BartMassey-upstream/portaudio-rs
that referenced
this issue
May 13, 2020
Two uses of mem::forget() after user callbacks were replaced with Box::leak() before the user callbacks to ensure that unowned memory was not improperly freed on panic.
Resolved in #21 |
Thank you for the report! 👍 |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
It is observed that the
stream_callback
andstream_finished_callback
functions are not unwind safe, as their definitions shown below.If the user-provided closure could possibly panic, the
mem::forget
of boxedStreamUserData
would not be reachable, which causes its memory to be deallocated, thus resulting in anuse after free
.Since the
StreamUserData
contains two function pointers which might be executed later-on, it is obvious that an arbitrary code execution can be constructed maliciously by this way. Therefore, this is highly-vulnerable and should be fixed.The text was updated successfully, but these errors were encountered: