Index: src/inspector/V8StackTraceImpl.cpp |
diff --git a/src/inspector/V8StackTraceImpl.cpp b/src/inspector/V8StackTraceImpl.cpp |
index 25a0e7caf7892fd68b21cc0a37fa66cd5eee186f..2d6c39ac52bfad95ee06ec1d7fea268ec50a80a4 100644 |
--- a/src/inspector/V8StackTraceImpl.cpp |
+++ b/src/inspector/V8StackTraceImpl.cpp |
@@ -12,6 +12,8 @@ |
#include "include/v8-profiler.h" |
#include "include/v8-version.h" |
+#include <limits> |
+ |
namespace v8_inspector { |
namespace { |
@@ -45,7 +47,8 @@ void toFramesVector(v8::Local<v8::StackTrace> stackTrace, |
size_t maxStackSize, v8::Isolate* isolate) { |
DCHECK(isolate->InContext()); |
int frameCount = stackTrace->GetFrameCount(); |
- if (frameCount > static_cast<int>(maxStackSize)) frameCount = maxStackSize; |
+ if (frameCount > static_cast<int>(maxStackSize)) |
+ frameCount = static_cast<int>(maxStackSize); |
for (int i = 0; i < frameCount; i++) { |
v8::Local<v8::StackFrame> stackFrame = stackTrace->GetFrame(i); |
frames.push_back(toFrame(stackFrame)); |
@@ -159,8 +162,9 @@ std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::capture( |
v8::Local<v8::StackTrace> stackTrace; |
if (isolate->InContext()) { |
isolate->GetCpuProfiler()->CollectSample(); |
- stackTrace = v8::StackTrace::CurrentStackTrace(isolate, maxStackSize, |
- stackTraceOptions); |
+ DCHECK(maxStackSize <= std::numeric_limits<int>::max()); |
+ stackTrace = v8::StackTrace::CurrentStackTrace( |
+ isolate, static_cast<int>(maxStackSize), stackTraceOptions); |
} |
return V8StackTraceImpl::create(debugger, contextGroupId, stackTrace, |
maxStackSize, description); |