Fix use-after-free in EglDisplay destructor when terminate() not called#123
Open
VladimirTechMan wants to merge 1 commit intogoogle:mainfrom
Open
Fix use-after-free in EglDisplay destructor when terminate() not called#123VladimirTechMan wants to merge 1 commit intogoogle:mainfrom
VladimirTechMan wants to merge 1 commit intogoogle:mainfrom
Conversation
m_contexts and m_surfaces hold objects whose destructors reference m_manager[]. The destructor body calls `delete m_manager[]` explicitly, but member variables are destroyed by C++ after the destructor body completes. If terminate() was never called, m_contexts and m_surfaces are still populated at that point, so their elements are destroyed after m_manager[] is already freed. terminate() avoids this by clearing both maps while m_manager[] is still alive, but that only helps if it is actually called. Replicate the same clearing at the top of the destructor body so the fix applies regardless. Signed-off-by: VladimirTechMan <1228301+VladimirTechMan@users.noreply.github.com>
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.
m_contexts and m_surfaces hold objects whose destructors reference m_manager[]. The destructor body calls
delete m_manager[]explicitly, but member variables are destroyed by C++ after the destructor body completes. If terminate() was never called, m_contexts and m_surfaces are still populated at that point, so their elements are destroyed after m_manager[] is already freed.terminate() avoids this by clearing both maps while m_manager[] is still alive, but that only helps if it is actually called. Replicate the same clearing at the top of the destructor body so the fix applies regardless.