Add recursion limit for VM (#2737)
This patch adds posibility to supervise the VM call stack to avoid aborts/crashes due to the recursion calls. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
committed by
László Langó
parent
5c1a4f18ea
commit
6b9c924d08
@@ -40,6 +40,7 @@ set(FEATURE_VALGRIND OFF CACHE BOOL "Enable Valgrind support?")
|
||||
set(FEATURE_VM_EXEC_STOP OFF CACHE BOOL "Enable VM execution stopping?")
|
||||
set(MEM_HEAP_SIZE_KB "512" CACHE STRING "Size of memory heap, in kilobytes")
|
||||
set(REGEXP_RECURSION_LIMIT "0" CACHE STRING "Limit of regexp recursion depth")
|
||||
set(VM_RECURSION_LIMIT "0" CACHE STRING "Limit of VM recursion depth")
|
||||
|
||||
# Option overrides
|
||||
if(USING_MSVC)
|
||||
@@ -96,6 +97,7 @@ message(STATUS "FEATURE_VALGRIND " ${FEATURE_VALGRIND})
|
||||
message(STATUS "FEATURE_VM_EXEC_STOP " ${FEATURE_VM_EXEC_STOP})
|
||||
message(STATUS "MEM_HEAP_SIZE_KB " ${MEM_HEAP_SIZE_KB})
|
||||
message(STATUS "REGEXP_RECURSION_LIMIT " ${REGEXP_RECURSION_LIMIT})
|
||||
message(STATUS "VM_RECURSION_LIMIT " ${VM_RECURSION_LIMIT})
|
||||
|
||||
# Include directories
|
||||
set(INCLUDE_CORE_PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
@@ -235,6 +237,11 @@ if(REGEXP_RECURSION_LIMIT)
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} REGEXP_RECURSION_LIMIT=${REGEXP_RECURSION_LIMIT})
|
||||
endif()
|
||||
|
||||
# VM recursion depth limit
|
||||
if(VM_RECURSION_LIMIT)
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} VM_RECURSION_LIMIT=${VM_RECURSION_LIMIT})
|
||||
endif()
|
||||
|
||||
# RegExp byte-code dumps
|
||||
if(FEATURE_REGEXP_DUMP)
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} REGEXP_DUMP_BYTE_CODE)
|
||||
|
||||
Reference in New Issue
Block a user