From dfd9c93ab07389ff9985197b443dac3b2a6283ce Mon Sep 17 00:00:00 2001 From: Fabrice Bellard Date: Thu, 13 Mar 2025 17:27:38 +0100 Subject: [PATCH] added missing stack overflow check in JSON.stringify() --- quickjs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/quickjs.c b/quickjs.c index 8871a71..8ba1188 100644 --- a/quickjs.c +++ b/quickjs.c @@ -45412,6 +45412,11 @@ static int js_json_to_str(JSContext *ctx, JSONStringifyContext *jsc, tab = JS_UNDEFINED; prop = JS_UNDEFINED; + if (js_check_stack_overflow(ctx->rt, 0)) { + JS_ThrowStackOverflow(ctx); + goto exception; + } + if (JS_IsObject(val)) { p = JS_VALUE_GET_OBJ(val); cl = p->class_id;