Fix heap-use-after-free in workspace switch animation#353
Open
jbms wants to merge 1 commit into
Open
Conversation
During rapid workspace switching, empty workspaces can be destroyed synchronously when transactions are completed. If an active animation's filter data still holds a raw pointer to a destroyed workspace, it results in a heap-use-after-free when the layout is next arranged. This patch fixes the issue by registering destroy listeners on both the 'from' and 'to' workspaces in `workspace_switch_data`. When a workspace is destroyed, its pointer in the animation data is set to NULL. The filters and layout code are updated to safely handle NULL workspaces. Additionally, disable animations by default in `ScrollInstance.reset()` to prevent test pollution between test runs.
Contributor
Author
|
It turns out that your previous fix did not fully eliminate the possibility of use-after-free during workspace switch animations, it just made it happen less reliably. This adds listeners to reliably fix the problem. |
Owner
|
I am curious about how you make it crash now. Is there a test or a command I can run? |
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.
During rapid workspace switching, empty workspaces can be destroyed synchronously when transactions are completed. If an active animation's filter data still holds a raw pointer to a destroyed workspace, it results in a heap-use-after-free when the layout is next arranged.
This patch fixes the issue by registering destroy listeners on both the 'from' and 'to' workspaces in
workspace_switch_data. When a workspace is destroyed, its pointer in the animation data is set to NULL. The filters and layout code are updated to safely handle NULL workspaces.Additionally, disable animations by default in
ScrollInstance.reset()to prevent test pollution between test runs.