]> git.kaiwu.me - quickjs.git/commitdiff
Check the stack when instanceof follows a bound function
authorFabrice Bellard <fabrice@bellard.org>
Sat, 21 Nov 2026 13:37:44 +0000 (14:37 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Sat, 21 Nov 2026 13:37:44 +0000 (14:37 +0100)
quickjs.c

index 535ebcc1af11c3a31ac63869e2769dfd87fe8596..dd83cc9f344a4119b0f08f8a11b17635be714a1c 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -8206,6 +8206,10 @@ int JS_OrdinaryIsInstanceOf(JSContext *ctx, JSValueConst val,
     p = JS_VALUE_GET_OBJ(obj);
     if (p->class_id == JS_CLASS_BOUND_FUNCTION) {
         JSBoundFunction *s = p->u.bound_function;
+        if (js_check_stack_overflow(ctx->rt, 0)) {
+            JS_ThrowStackOverflow(ctx);
+            return -1;
+        }
         return JS_IsInstanceOf(ctx, val, s->func_obj);
     }