Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index f56f99b8f6d7355698f62f998191e0ac26dfb642..5f7b3f2d3b6134b0c8518d76eca776ad1d8b98fd 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -1042,7 +1042,8 @@ Failure* Isolate::StackOverflow() { |
Handle<Object> stack_trace_limit = |
GetProperty(Handle<JSObject>::cast(error), "stackTraceLimit"); |
if (!stack_trace_limit->IsNumber()) return Failure::Exception(); |
- int limit = static_cast<int>(stack_trace_limit->Number()); |
+ double dlimit = stack_trace_limit->Number(); |
+ int limit = isnan(dlimit) ? 0 : static_cast<int>(dlimit); |
Handle<JSArray> stack_trace = CaptureSimpleStackTrace( |
exception, factory()->undefined_value(), limit); |