Skip to content

Commit

Permalink
Add CONFIG_STACK_SIZE_MAX for overridding default limit (bellard#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
trufae authored and oleavr committed Jan 18, 2024
1 parent 9e53e9d commit c87d3ca
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 @@ -39,6 +39,9 @@ CONFIG_LTO=y
# 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 Down Expand Up @@ -112,6 +115,12 @@ ifdef CONFIG_WERROR
CFLAGS+=-Werror
endif
DEFINES:=-D_GNU_SOURCE -DCONFIG_VERSION=\"$(shell cat VERSION.txt)\"
ifdef CONFIG_STACK_CHECK
DEFINES+=-DCONFIG_STACK_CHECK=1
ifdef CONFIG_STACK_SIZE_MAX
DEFINES+=-DCONFIG_STACK_SIZE_MAX=$(CONFIG_STACK_SIZE_MAX)
endif
endif
ifdef CONFIG_BIGNUM
DEFINES+=-DCONFIG_BIGNUM
endif
Expand Down
4 changes: 4 additions & 0 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ typedef enum JSErrorEnum {
} JSErrorEnum;

#define JS_MAX_LOCAL_VARS 65535
#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 c87d3ca

Please sign in to comment.