]> git.kaiwu.me - quickjs.git/commitdiff
Check for stack overflow in JS_IteratorNext fast path (josefguenther)
authorFabrice Bellard <fabrice@bellard.org>
Sat, 21 Nov 2026 13:32:04 +0000 (14:32 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Sat, 21 Nov 2026 13:32:04 +0000 (14:32 +0100)
quickjs.c

index 9983a627ad3544edfa84818cf4b3101db923a559..535ebcc1af11c3a31ac63869e2769dfd87fe8596 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -16980,6 +16980,10 @@ static JSValue JS_IteratorNext3(JSContext *ctx, JSValueConst enum_obj,
             JSCFunctionType func;
             JSValueConst args[1];
 
+            if (js_check_stack_overflow(ctx->rt, 0)) {
+                JS_ThrowStackOverflow(ctx);
+                goto fail;
+            }
             /* in case the function expects one argument */
             if (argc == 0) {
                 args[0] = JS_UNDEFINED;