diff options
-rw-r--r-- | base/event_trace_provider_win.cc | 4 | ||||
-rw-r--r-- | base/event_trace_provider_win.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/base/event_trace_provider_win.cc b/base/event_trace_provider_win.cc index 69fcd57..4c43b72 100644 --- a/base/event_trace_provider_win.cc +++ b/base/event_trace_provider_win.cc @@ -99,7 +99,7 @@ ULONG EtwTraceProvider::Log(const EtwEventClass& event_class, event.fields[0].DataPtr = reinterpret_cast<ULONG64>(message); event.fields[0].Length = message ? - sizeof(message[0]) * (1 + strlen(message)) : 0; + static_cast<ULONG>(sizeof(message[0]) * (1 + strlen(message))) : 0; return ::TraceEvent(session_handle_, &event.header); } @@ -113,7 +113,7 @@ ULONG EtwTraceProvider::Log(const EtwEventClass& event_class, event.fields[0].DataPtr = reinterpret_cast<ULONG64>(message); event.fields[0].Length = message ? - sizeof(message[0]) * (1 + wcslen(message)) : 0; + static_cast<ULONG>(sizeof(message[0]) * (1 + wcslen(message))) : 0; return ::TraceEvent(session_handle_, &event.header); } diff --git a/base/event_trace_provider_win.h b/base/event_trace_provider_win.h index bf186ee..9668740 100644 --- a/base/event_trace_provider_win.h +++ b/base/event_trace_provider_win.h @@ -56,9 +56,9 @@ template <size_t N> class EtwMofEvent: public EtwMofEventBase<N> { void SetField(int field, size_t size, const void *data) { // DCHECK(field < N); - if (field < N) { + if ((field < N) && (size <= kuint32max)) { fields[field].DataPtr = reinterpret_cast<ULONG64>(data); - fields[field].Length = size; + fields[field].Length = static_cast<ULONG>(size); } } |