summaryrefslogtreecommitdiff
path: root/platform/windows/platform_windows.cpp
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2026-05-26 16:32:00 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2026-05-28 14:09:06 -0400
commit96d00358954807095418da56421467f2f93dd905 (patch)
tree7b855a37566df8d01ffd2d9403644555df013f80 /platform/windows/platform_windows.cpp
parent6ce58cb5b8355ada533e7bf5e5c10ec0ff76bc92 (diff)
[Windows] Fix x64 platform view init race condition
This mirrors the fix that was performed on the x86 platform
Diffstat (limited to 'platform/windows/platform_windows.cpp')
-rw-r--r--platform/windows/platform_windows.cpp3
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"))));
}