diff options
| author | Mason Reed <mason@vector35.com> | 2026-05-26 16:32:00 -0400 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2026-05-28 14:09:06 -0400 |
| commit | 96d00358954807095418da56421467f2f93dd905 (patch) | |
| tree | 7b855a37566df8d01ffd2d9403644555df013f80 | |
| parent | 6ce58cb5b8355ada533e7bf5e5c10ec0ff76bc92 (diff) | |
[Windows] Fix x64 platform view init race condition
This mirrors the fix that was performed on the x86 platform
| -rw-r--r-- | platform/windows/platform_windows.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/platform/windows/platform_windows.cpp b/platform/windows/platform_windows.cpp index b4b7c55d..612e5cf5 100644 --- a/platform/windows/platform_windows.cpp +++ b/platform/windows/platform_windows.cpp @@ -92,6 +92,7 @@ class WindowsX64Platform: public Platform { uint32_t m_gsbase; Ref<Type> m_teb; + std::mutex m_tebMutex; public: WindowsX64Platform(Architecture* arch): Platform(arch, "windows-x86_64") @@ -113,6 +114,8 @@ public: virtual void BinaryViewInit(BinaryView* view) override { + // Locking here so that if we have two views in BinaryViewInit at once we don't race to init m_teb. + std::lock_guard<std::mutex> lock(m_tebMutex); if (!m_teb) m_teb = Type::PointerType(GetArchitecture()->GetAddressSize(), Type::NamedType(QualifiedName("TEB"), GetTypeByName(QualifiedName("TEB")))); } |
