Fix use-after-free race condition in visualizer#130
Merged
nyanpasu64 merged 1 commit intoDn-Programming-Core-Management:masterfrom Apr 22, 2022
Merged
Conversation
efd641a to
a6577b1
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes a race condition causing the visualizer thread's
CVisualizerWnd::ThreadProc()to pass freed memory (pDrawBuffer) toCVisualizerBase::SetSampleData(). This could occur randomly upon changing buffer size on DirectSound, or randomly on WASAPI. When it happens, the visualizer can display corrupted contents or even segfault.To reproduce the bug easily, checkout master without this branch's changes, then edit
CVisualizerWnd::ThreadProc()and addSleep(50);afterm_csBufferSelect.Unlock();beforem_csBuffer.Lock();.This does not rewrite the entire visualizer system unlike #127. This is good since master (and this branch)'s oscilloscope visualizer is less choppy on DirectSound than #127, and WASAPI (which replaces DirectSound) isn't merged yet.