From 952892a28a06a4ced120d4683d930699b9d730de Mon Sep 17 00:00:00 2001 From: brucedawson Date: Mon, 9 Nov 2015 22:51:52 -0800 Subject: [PATCH] Fix a 64-bit pointer truncation bug found by VC++ 2015 When converting from void* to unsigned long long it is dangerous to go through unsigned long because for VC++ 64-bit builds this will be 32 bits. When casting a pointer to an integral type the safest type to choose for the integral cast is always intptr_t or uintptr_t. BUG=440500 NOPRESUBMIT=true Review URL: https://codereview.webrtc.org/1437433002 Cr-Commit-Position: refs/heads/master@{#10569} --- webrtc/base/trace_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc/base/trace_event.h b/webrtc/base/trace_event.h index c14cbff030..3916af4fb6 100644 --- a/webrtc/base/trace_event.h +++ b/webrtc/base/trace_event.h @@ -701,7 +701,7 @@ class TraceID { explicit TraceID(const void* id, unsigned char* flags) : data_(static_cast( - reinterpret_cast(id))) { + reinterpret_cast(id))) { *flags |= TRACE_EVENT_FLAG_MANGLE_ID; } explicit TraceID(ForceMangle id, unsigned char* flags) : data_(id.data()) {