Skip to content

Commit 228596f

Browse files
committed
Handle return value of JS_ToFloat64
Fixes: #890
1 parent bb14020 commit 228596f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

quickjs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6765,7 +6765,9 @@ static void build_backtrace(JSContext *ctx, JSValue error_val, JSValue filter_fu
67656765
saved_exception = JS_GetException(ctx);
67666766

67676767
// Extract stack trace limit.
6768-
JS_ToFloat64(ctx, &d, ctx->error_stack_trace_limit);
6768+
if (JS_ToFloat64(ctx, &d, ctx->error_stack_trace_limit) < 0) {
6769+
// Ignore error since it sets d to NAN anyway.
6770+
}
67696771
if (isnan(d) || d < 0.0)
67706772
stack_trace_limit = 0;
67716773
else if (d > INT32_MAX)

0 commit comments

Comments
 (0)