commit 4c2d29a6bd9af1cf8f52e17acd9dc1c7ed7ad76f
Author: Tom Ritter <tom(a)mozilla.com>
Date: Wed May 16 14:18:20 2018 -0500
Bug 1462100 - Cast to void* to avoid conversion errors on MinGW, which does not do the automatic conversion like msvc. r=bobowen, a=RyanVM
MozReview-Commit-ID: 8fO9Nu9gaxh
---
.../with_update/mingw_noexports_casts.patch | 41 ++++++++++++++++++++++
.../patches/with_update/patch_order.txt | 3 +-
.../chromium/sandbox/win/src/interception.h | 4 +--
3 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/security/sandbox/chromium-shim/patches/with_update/mingw_noexports_casts.patch b/security/sandbox/chromium-shim/patches/with_update/mingw_noexports_casts.patch
new file mode 100644
index 000000000000..a9c1001c7675
--- /dev/null
+++ b/security/sandbox/chromium-shim/patches/with_update/mingw_noexports_casts.patch
@@ -0,0 +1,41 @@
+# HG changeset patch
+# User Tom Ritter <tom(a)mozilla.com>
+# Date 1526498300 18000
+# Wed May 16 14:18:20 2018 -0500
+# Node ID dd3f4940aeb0c4e00e8bcf1c238f2355ad793489
+# Parent cf646c80b9545db7ab548f88a482378734ee2f78
+Bug 1462100 Cast to void* to avoid conversion errors on MinGW, which does not do the automatic conversion like msvc r?bobowen
+
+MozReview-Commit-ID: 8fO9Nu9gaxh
+
+diff --git a/security/sandbox/chromium/sandbox/win/src/interception.h b/security/sandbox/chromium/sandbox/win/src/interception.h
+--- a/security/sandbox/chromium/sandbox/win/src/interception.h
++++ b/security/sandbox/chromium/sandbox/win/src/interception.h
+@@ -264,25 +264,25 @@ class InterceptionManager {
+ #define MAKE_SERVICE_NAME(service) &Target##service##64
+ #else
+ #define MAKE_SERVICE_NAME(service) &Target##service
+ #endif
+
+ #define ADD_NT_INTERCEPTION(service, id, num_params) \
+ AddToPatchedFunctions(kNtdllName, #service, \
+ sandbox::INTERCEPTION_SERVICE_CALL, \
+- MAKE_SERVICE_NAME(service), id)
++ (void*)MAKE_SERVICE_NAME(service), id)
+
+ #define INTERCEPT_NT(manager, service, id, num_params) \
+ manager->ADD_NT_INTERCEPTION(service, id, num_params)
+
+ // When intercepting the EAT it is important that the patched version of the
+ // function not call any functions imported from system libraries unless
+ // |TargetServices::InitCalled()| returns true, because it is only then that
+ // we are guaranteed that our IAT has been initialized.
+ #define INTERCEPT_EAT(manager, dll, function, id, num_params) \
+ manager->AddToPatchedFunctions(dll, #function, sandbox::INTERCEPTION_EAT, \
+- MAKE_SERVICE_NAME(function), id)
++ (void*)MAKE_SERVICE_NAME(function), id)
+ #endif // SANDBOX_EXPORTS
+
+ } // namespace sandbox
+
+ #endif // SANDBOX_SRC_INTERCEPTION_H_
diff --git a/security/sandbox/chromium-shim/patches/with_update/patch_order.txt b/security/sandbox/chromium-shim/patches/with_update/patch_order.txt
index e9dbbec9514d..7715c4765982 100755
--- a/security/sandbox/chromium-shim/patches/with_update/patch_order.txt
+++ b/security/sandbox/chromium-shim/patches/with_update/patch_order.txt
@@ -18,4 +18,5 @@ mingw_copy_s.patch
mingw_operator_new.patch
mingw_cast_getprocaddress.patch
mingw_capitalization.patch
-mingw_disable_one_try.patch
\ No newline at end of file
+mingw_disable_one_try.patch
+mingw_noexports_casts.patch
\ No newline at end of file
diff --git a/security/sandbox/chromium/sandbox/win/src/interception.h b/security/sandbox/chromium/sandbox/win/src/interception.h
index d21bed30b5fd..8a4310371e0f 100644
--- a/security/sandbox/chromium/sandbox/win/src/interception.h
+++ b/security/sandbox/chromium/sandbox/win/src/interception.h
@@ -269,7 +269,7 @@ class InterceptionManager {
#define ADD_NT_INTERCEPTION(service, id, num_params) \
AddToPatchedFunctions(kNtdllName, #service, \
sandbox::INTERCEPTION_SERVICE_CALL, \
- MAKE_SERVICE_NAME(service), id)
+ (void*)MAKE_SERVICE_NAME(service), id)
#define INTERCEPT_NT(manager, service, id, num_params) \
manager->ADD_NT_INTERCEPTION(service, id, num_params)
@@ -280,7 +280,7 @@ class InterceptionManager {
// we are guaranteed that our IAT has been initialized.
#define INTERCEPT_EAT(manager, dll, function, id, num_params) \
manager->AddToPatchedFunctions(dll, #function, sandbox::INTERCEPTION_EAT, \
- MAKE_SERVICE_NAME(function), id)
+ (void*)MAKE_SERVICE_NAME(function), id)
#endif // SANDBOX_EXPORTS
} // namespace sandbox