Skip to content

Commit f106b7c

Browse files
committed
Fix resetting current exception while in build_backtrace
Also initialize `saved_exception` to something to avoid a maybe-uninitialized warning that shows up at least on GCC 13.
1 parent ab48ede commit f106b7c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

quickjs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6640,6 +6640,7 @@ static void build_backtrace(JSContext *ctx, JSValue error_obj, JSValue filter_fu
66406640
uint32_t i;
66416641
int stack_trace_limit;
66426642

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

66566657
if (has_prepare) {
66576658
saved_exception = rt->current_exception;
6658-
rt->current_exception = JS_NULL;
6659+
rt->current_exception = JS_UNINITIALIZED;
66596660
if (stack_trace_limit == 0)
66606661
goto done;
66616662
if (filename)
@@ -18007,7 +18008,7 @@ static bool js_async_function_resume(JSContext *ctx, JSAsyncFunctionData *s)
1800718008
if (unlikely(JS_IsException(ret2))) {
1800818009
if (JS_IsUncatchableError(ctx, ctx->rt->current_exception)) {
1800918010
is_success = false;
18010-
} else {
18011+
} else {
1801118012
abort(); /* BUG */
1801218013
}
1801318014
}

0 commit comments

Comments
 (0)