From e035f85bccdf6d26f8d13289c0d1bdb7d1f396b5 Mon Sep 17 00:00:00 2001 From: Roger Wang Date: Sun, 22 Oct 2023 17:46:28 -0600 Subject: [PATCH] Fix: abort on unaligned pointer in worker threads on Win Fix nwjs/nw.js#8082 --- src/node_contextify.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 2f3956e7fa..9773ecc42d 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -260,7 +260,8 @@ BaseObjectPtr ContextifyContext::New( sandbox_obj); if (node_is_nwjs) { void* data = env->context()->GetAlignedPointerFromEmbedderData(2); //v8ContextPerContextDataIndex - v8_context->SetAlignedPointerInEmbedderData(2, data); + if (!((int)data & 1)) + v8_context->SetAlignedPointerInEmbedderData(2, data); v8_context->SetAlignedPointerInEmbedderData(50, (void*)0x08110800); }