summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTommi <tommi@webrtc.org>2020-01-15 17:28:29 +0100
committerMichael BrĂ¼ning <michael.bruning@qt.io>2020-01-16 09:07:52 +0000
commitf32f09593b6dbd0d7e7f6adbf23e8cda24f7f0e6 (patch)
tree9ba2b306b39390f4874abf7a73eeb4340a8b4f9e
parent9e44d0450c1dee471dca970ae60c6ad7d76ddfa5 (diff)
downloadqtwebengine-chromium-f32f09593b6dbd0d7e7f6adbf23e8cda24f7f0e6.tar.gz
[Backport] Security bug 1025089
Backport of patch: [m79] Fix number of arguments being passed when setting the thread name on Windows. BUGS=webrtc:11079,chromium:1025089 (cherry picked from commit 7d5fe67b835e128ca688ccb361c98dd432556e2c) Change-Id: I0ed17dd53ab0b2eeb295689192a5c0586991340f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--chromium/third_party/webrtc/rtc_base/platform_thread_types.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/chromium/third_party/webrtc/rtc_base/platform_thread_types.cc b/chromium/third_party/webrtc/rtc_base/platform_thread_types.cc
index 67bb0542e9b..ba774ae4dbc 100644
--- a/chromium/third_party/webrtc/rtc_base/platform_thread_types.cc
+++ b/chromium/third_party/webrtc/rtc_base/platform_thread_types.cc
@@ -58,18 +58,25 @@ bool IsThreadRefEqual(const PlatformThreadRef& a, const PlatformThreadRef& b) {
void SetCurrentThreadName(const char* name) {
#if defined(WEBRTC_WIN)
+// For details see:
+// https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code
+#pragma pack(push, 8)
struct {
DWORD dwType;
LPCSTR szName;
DWORD dwThreadID;
DWORD dwFlags;
} threadname_info = {0x1000, name, static_cast<DWORD>(-1), 0};
+#pragma pack(pop)
+#pragma warning(push)
+#pragma warning(disable : 6320 6322)
__try {
- ::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(DWORD),
+ ::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(ULONG_PTR),
reinterpret_cast<ULONG_PTR*>(&threadname_info));
} __except (EXCEPTION_EXECUTE_HANDLER) { // NOLINT
}
+#pragma warning(pop)
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name)); // NOLINT
#elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS)