Commit 6e547e90 authored by Stephan Herhut's avatar Stephan Herhut Committed by Commit Bot

Sanitize nullptr name in wasm profiling events.

For some wasm functions, name information is not available, resulting
in a nullptr being passed to the profiling event listener. While we
probably should have better names, this at least prevents a crash.

Change-Id: I41bd7827124e9c193a076a57d3a134f5df1d6a15
Reviewed-on: https://chromium-review.googlesource.com/926367
Commit-Queue: Stephan Herhut <herhut@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51396}
parent 07abe39a
......@@ -118,11 +118,14 @@ void ProfilerListener::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
rec->start = code->instructions().start();
// TODO(herhut): Instead of sanitizing here, make sure all wasm functions
// have names.
const char* name_ptr =
name.start() == nullptr ? "<anonymous>" : GetFunctionName(name.start());
rec->entry = NewCodeEntry(
tag, GetFunctionName(name.start()), CodeEntry::kEmptyNamePrefix,
CodeEntry::kEmptyResourceName, CpuProfileNode::kNoLineNumberInfo,
CpuProfileNode::kNoColumnNumberInfo, nullptr,
code->instructions().start());
tag, name_ptr, CodeEntry::kEmptyNamePrefix, CodeEntry::kEmptyResourceName,
CpuProfileNode::kNoLineNumberInfo, CpuProfileNode::kNoColumnNumberInfo,
nullptr, code->instructions().start());
rec->size = code->instructions().length();
DispatchCodeEvent(evt_rec);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment