From bf1facaea34c0560ec99e35b1e5a16bb277a3e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 1 Dec 2023 09:19:26 +0100 Subject: [PATCH] Always enable stack checking Seems to work in Emscripten and it can be disabled with JS_SetMaxStackSize(rt, 0). --- quickjs.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/quickjs.c b/quickjs.c index b64a59f..86c2fc6 100644 --- a/quickjs.c +++ b/quickjs.c @@ -67,12 +67,6 @@ #define CONFIG_PRINTF_RNDN #endif -#if !defined(EMSCRIPTEN) -/* enable stack limitation */ -#define CONFIG_STACK_CHECK -#endif - - /* dump object free */ //#define DUMP_FREE //#define DUMP_CLOSURE @@ -1555,18 +1549,6 @@ static int init_class_range(JSRuntime *rt, JSClassShortDef const *tab, return 0; } -#if !defined(CONFIG_STACK_CHECK) -/* no stack limitation */ -static inline uintptr_t js_get_stack_pointer(void) -{ - return 0; -} - -static inline BOOL js_check_stack_overflow(JSRuntime *rt, size_t alloca_size) -{ - return FALSE; -} -#else /* Note: OS and CPU dependent */ static inline uintptr_t js_get_stack_pointer(void) { @@ -1579,7 +1561,6 @@ static inline BOOL js_check_stack_overflow(JSRuntime *rt, size_t alloca_size) sp = js_get_stack_pointer() - alloca_size; return unlikely(sp < rt->stack_limit); } -#endif JSRuntime *JS_NewRuntime2(const JSMallocFunctions *mf, void *opaque) {