Skip to content

Fix resetting current exception while in build_backtrace #846

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -6640,6 +6640,7 @@ static void build_backtrace(JSContext *ctx, JSValue error_obj, JSValue filter_fu
uint32_t i;
int stack_trace_limit;

saved_exception = JS_UNINITIALIZED;
stack_trace_limit = ctx->error_stack_trace_limit;
stack_trace_limit = min_int(stack_trace_limit, countof(csd));
stack_trace_limit = max_int(stack_trace_limit, 0);
Expand All @@ -6655,7 +6656,7 @@ static void build_backtrace(JSContext *ctx, JSValue error_obj, JSValue filter_fu

if (has_prepare) {
saved_exception = rt->current_exception;
rt->current_exception = JS_NULL;
rt->current_exception = JS_UNINITIALIZED;
if (stack_trace_limit == 0)
goto done;
if (filename)
Expand Down Expand Up @@ -18007,7 +18008,7 @@ static bool js_async_function_resume(JSContext *ctx, JSAsyncFunctionData *s)
if (unlikely(JS_IsException(ret2))) {
if (JS_IsUncatchableError(ctx, ctx->rt->current_exception)) {
is_success = false;
} else {
} else {
abort(); /* BUG */
}
}
Expand Down
Loading