mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Fix null deref in js_iterator_helper_next
Fixes: https://github.com/quickjs-ng/quickjs/issues/705
This commit is contained in:
parent
0b9b6c1915
commit
ef15418807
1 changed files with 3 additions and 5 deletions
|
@ -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);
|
it = JS_GetOpaque2(ctx, this_val, JS_CLASS_ITERATOR_HELPER);
|
||||||
if (!it)
|
if (!it)
|
||||||
goto fail;
|
return JS_EXCEPTION;
|
||||||
if (it->executing)
|
if (it->executing)
|
||||||
return JS_ThrowTypeError(ctx, "cannot invoke a running iterator");
|
return JS_ThrowTypeError(ctx, "cannot invoke a running iterator");
|
||||||
if (it->done) {
|
if (it->done) {
|
||||||
|
@ -40847,10 +40847,8 @@ done:
|
||||||
it->executing = 0;
|
it->executing = 0;
|
||||||
return ret;
|
return ret;
|
||||||
fail:
|
fail:
|
||||||
if (it) {
|
|
||||||
/* close the iterator object, preserving pending exception */
|
/* close the iterator object, preserving pending exception */
|
||||||
JS_IteratorClose(ctx, it->obj, TRUE);
|
JS_IteratorClose(ctx, it->obj, TRUE);
|
||||||
}
|
|
||||||
ret = JS_EXCEPTION;
|
ret = JS_EXCEPTION;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue