Skip to content

Fix: Resolved a memory error caused by incompatible std::map implementations when multiple plugins were compiled with different C++ standards. #167804

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

toneyzeng
Copy link

Fix: Resolved a memory error caused by incompatible std::map implementations when multiple plugins were compiled with different C++ standards.

Issue Description:

A crash occurred due to a mismatch in std::map ABI when two plugins were statically linked for debugging:

window_manager was compiled with C++20 (cxx_std_20).

ump_video_plugin was compiled with C++17 (cxx_std_17).

The error manifested in plugin_registrar.h where a std::map held plugin instances:

using WrapperMap = std::map<FlutterDesktopPluginRegistrarRef, std::unique_ptr>;

Root Cause:

When window_manager registered first, it initialized PluginRegistrarManager::GetInstance() with a std::map constructed under C++20.

Later, ump_video_plugin (using C++17) attempted to access the same map, leading to memory corruption due to ABI incompatibility between the two std::map implementations.

Solution: Embed Standard Library and Memory Allocation Within the Singleton

…tations when multiple plugins were compiled with different C++ standards.

Issue Description:

A crash occurred due to a mismatch in std::map ABI when two plugins were statically linked for debugging:

window_manager was compiled with C++20 (cxx_std_20).

ump_video_plugin was compiled with C++17 (cxx_std_17).

The error manifested in plugin_registrar.h where a std::map held plugin instances:

using WrapperMap = std::map<FlutterDesktopPluginRegistrarRef, std::unique_ptr<PluginRegistrar>>;

Root Cause:

When window_manager registered first, it initialized PluginRegistrarManager::GetInstance() with a std::map constructed under C++20.

Later, ump_video_plugin (using C++17) attempted to access the same map, leading to memory corruption due to ABI incompatibility between the two std::map implementations.

Solution: Embed Standard Library and Memory Allocation Within the Singleton
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions bot added the engine flutter/engine repository. See also e: labels. label Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine flutter/engine repository. See also e: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy