Skip to content
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

Fix null deref in js_iterator_helper_next #706

Merged
merged 1 commit into from
Nov 19, 2024
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
8 changes: 3 additions & 5 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -40615,7 +40615,7 @@ static JSValue js_iterator_helper_next(JSContext *ctx, JSValue this_val,

it = JS_GetOpaque2(ctx, this_val, JS_CLASS_ITERATOR_HELPER);
if (!it)
goto fail;
return JS_EXCEPTION;
if (it->executing)
return JS_ThrowTypeError(ctx, "cannot invoke a running iterator");
if (it->done) {
Expand Down Expand Up @@ -40847,10 +40847,8 @@ static JSValue js_iterator_helper_next(JSContext *ctx, JSValue this_val,
it->executing = 0;
return ret;
fail:
if (it) {
/* close the iterator object, preserving pending exception */
JS_IteratorClose(ctx, it->obj, TRUE);
}
/* close the iterator object, preserving pending exception */
JS_IteratorClose(ctx, it->obj, TRUE);
ret = JS_EXCEPTION;
goto done;
}
Expand Down
Loading