Add stack-overflow check to 'lexer_construct_function_object' (#4965)

This patch fixes #4887.

JerryScript-DCO-1.0-Signed-off-by: Martin Negyokru negyokru@inf.u-szeged.hu
This commit is contained in:
mnegyokru
2022-01-14 11:02:50 +01:00
committed by GitHub
parent 57547d1261
commit c68f6e79e1
3 changed files with 17 additions and 1 deletions
+6
View File
@@ -2799,6 +2799,12 @@ uint16_t
lexer_construct_function_object (parser_context_t *context_p, /**< context */
uint32_t extra_status_flags) /**< extra status flags */
{
#if (JERRY_STACK_LIMIT != 0)
if (JERRY_UNLIKELY (ecma_get_current_stack_usage () > CONFIG_MEM_STACK_LIMIT))
{
parser_raise_error (context_p, PARSER_ERR_STACK_OVERFLOW);
}
#endif /* JERRY_STACK_LIMIT != 0 */
ecma_compiled_code_t *compiled_code_p;
lexer_literal_t *literal_p;
uint16_t result_index;