Rework the engine's internal recursion limit (#2969)
This patch unifies the recursion limit checking for RegExp, function call and JSON as well. Until now the limit was only a counter which was increased/decreased at certain points. This counter has been substituted with a numeric limit which allows to restrict the stack usage. This patch fixes #2963 and resolves the closed #2258 issue. Co-authored-by: Gabor Loki loki@inf.u-szeged.hu JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
+16
-33
@@ -205,6 +205,19 @@
|
||||
# define JERRY_GLOBAL_HEAP_SIZE (512)
|
||||
#endif /* !defined (JERRY_GLOBAL_HEAP_SIZE) */
|
||||
|
||||
/**
|
||||
* Maximum stack usage size in kilobytes
|
||||
*
|
||||
* Note: This feature cannot be used when 'detect_stack_use_after_return=1' ASAN option is enabled.
|
||||
* For more detailed description:
|
||||
* - https://github.com/google/sanitizers/wiki/AddressSanitizerUseAfterReturn#compatibility
|
||||
*
|
||||
* Default value: 0, unlimited
|
||||
*/
|
||||
#ifndef JERRY_STACK_LIMIT
|
||||
# define JERRY_STACK_LIMIT (0)
|
||||
#endif /* !defined (JERRY_STACK_LIMIT) */
|
||||
|
||||
/**
|
||||
* Enable/Disable property lookup cache.
|
||||
*
|
||||
@@ -352,22 +365,6 @@
|
||||
# define JERRY_REGEXP_STRICT_MODE 0
|
||||
#endif /* !defined (JERRY_REGEXP_STRICT_MODE) */
|
||||
|
||||
/**
|
||||
* Set the RegExp parser and execution recursion limit.
|
||||
*
|
||||
* Allowed values:
|
||||
* 0: Disable recursion limit check.
|
||||
* 1 or greater: Set the recursion limit to the given number.
|
||||
*
|
||||
* Note:
|
||||
* A negative value will cause a static assert compiler error.
|
||||
*
|
||||
* Default value: 0
|
||||
*/
|
||||
#ifndef JERRY_REGEXP_RECURSION_LIMIT
|
||||
# define JERRY_REGEXP_RECURSION_LIMIT 0
|
||||
#endif /* !defined (JERRY_REGEXP_RECURSION_LIMIT) */
|
||||
|
||||
/**
|
||||
* Enable/Disable the snapshot execution functions.
|
||||
*
|
||||
@@ -435,23 +432,6 @@
|
||||
# define JERRY_VM_EXEC_STOP 0
|
||||
#endif /* !defined (JERRY_VM_EXEC_STOP) */
|
||||
|
||||
/**
|
||||
* Set the function call recursion limit.
|
||||
*
|
||||
* Allowed values:
|
||||
* 0: Disable recursion limit check.
|
||||
* 1 or greater: Set the recursion limit to the given number.
|
||||
*
|
||||
* Note:
|
||||
* A negative value will cause a static assert compiler error.
|
||||
*
|
||||
* Default value: 0
|
||||
*/
|
||||
#ifndef JERRY_CALL_STACK_LIMIT
|
||||
# define JERRY_CALL_STACK_LIMIT 0
|
||||
#endif /* !defined (JERRY_CALL_STACK_LIMIT) */
|
||||
|
||||
|
||||
/**
|
||||
* Advanced section configurations.
|
||||
*/
|
||||
@@ -631,6 +611,9 @@
|
||||
#if !defined (JERRY_GLOBAL_HEAP_SIZE) || (JERRY_GLOBAL_HEAP_SIZE <= 0)
|
||||
# error "Invalid value for 'JERRY_GLOBAL_HEAP_SIZE' macro."
|
||||
#endif
|
||||
#if !defined (JERRY_STACK_LIMIT) || (JERRY_STACK_LIMIT < 0)
|
||||
# error "Invalid value for 'JERRY_STACK_LIMIT' macro."
|
||||
#endif
|
||||
#if !defined (JERRY_LCACHE) \
|
||||
|| ((JERRY_LCACHE != 0) && (JERRY_LCACHE != 1))
|
||||
# error "Invalid value for 'JERRY_LCACHE' macro."
|
||||
|
||||
Reference in New Issue
Block a user