Skip to content
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

fix: don't export private V8 symbols that can cause native node modules to crash #18281

Merged
merged 9 commits into from Jun 3, 2019
1 change: 1 addition & 0 deletions patches/common/v8/.patches
Expand Up @@ -6,3 +6,4 @@ dcheck.patch
export_symbols_needed_for_windows_build.patch
workaround_an_undefined_symbol_error.patch
revert_cctest_add_v8_export_private_to_arm_arm64_ports.patch
do_not_export_private_v8_symbols_on_windows.patch
@@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tomas Rycl <torycl@microsoft.com>
Date: Mon, 13 May 2019 15:48:48 +0200
Subject: Do not export private V8 symbols on Windows

This change stops private V8 symbols and internal crt methods being exported.
It fixes an issue where native node modules can import
incorrect CRT methods and crash on Windows.
It also reduces size of node.lib by 75%.
torycl marked this conversation as resolved.
Show resolved Hide resolved

torycl marked this conversation as resolved.
Show resolved Hide resolved
diff --git a/src/base/macros.h b/src/base/macros.h
index 1276805182084bda3b72b30afb695d9c0648ad34..7be3c3370755dfe4deaffcb0598cc4d7d7cda0ba 100644
--- a/src/base/macros.h
+++ b/src/base/macros.h
@@ -416,9 +416,9 @@ bool is_inbounds(float_t v) {

// Setup for Windows shared library export.
#ifdef BUILDING_V8_SHARED
-#define V8_EXPORT_PRIVATE __declspec(dllexport)
+#define V8_EXPORT_PRIVATE /* __declspec(dllexport) */
#elif USING_V8_SHARED
-#define V8_EXPORT_PRIVATE __declspec(dllimport)
+#define V8_EXPORT_PRIVATE /* __declspec(dllimport) */
#else
#define V8_EXPORT_PRIVATE
#endif // BUILDING_V8_SHARED