Skip to content

Commit

Permalink
Add CONFIG_STACK_SIZE_MAX for overridding default limit (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
trufae authored Jan 26, 2023
1 parent 92beabe commit 65cfe08
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ endif
# installation directory
prefix=/usr/local

# avoid stack overflow on recursive calls
CONFIG_STACK_CHECK=y
# CONFIG_STACK_SIZE_MAX=0xffff
# use the gprof profiler
#CONFIG_PROFILE=y
# use address sanitizer
Expand All @@ -63,6 +66,12 @@ else
CROSS_PREFIX=
EXE=
endif
ifdef CONFIG_STACK_CHECK
CFLAGS += -DCONFIG_STACK_CHECK=1
ifdef CONFIG_STACK_SIZE_MAX
CFLAGS += -DCONFIG_STACK_SIZE_MAX=$(CONFIG_STACK_SIZE_MAX)
endif
endif
ifdef CONFIG_CLANG
HOST_CC=clang
CC=$(CROSS_PREFIX)clang
Expand Down
4 changes: 4 additions & 0 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,11 @@ typedef enum JSErrorEnum {
} JSErrorEnum;

#define JS_MAX_LOCAL_VARS 65536
#ifdef CONFIG_STACK_SIZE_MAX
#define JS_STACK_SIZE_MAX CONFIG_STACK_SIZE_MAX
#else
#define JS_STACK_SIZE_MAX 65534
#endif
#define JS_STRING_LEN_MAX ((1 << 30) - 1)

#define __exception __attribute__((warn_unused_result))
Expand Down

0 comments on commit 65cfe08

Please sign in to comment.