From 4443c88bf49482f0a24ca51a516c85c55add921b Mon Sep 17 00:00:00 2001 From: Szilagyi Adam Date: Wed, 4 Dec 2019 11:14:25 +0100 Subject: [PATCH] Fix index handling in ecma_op_advance_string_index (#3406) Fixes #3389 JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu --- jerry-core/ecma/base/ecma-helpers-string.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jerry-core/ecma/base/ecma-helpers-string.c b/jerry-core/ecma/base/ecma-helpers-string.c index faadfbd79..4d5a9eacd 100644 --- a/jerry-core/ecma/base/ecma-helpers-string.c +++ b/jerry-core/ecma/base/ecma-helpers-string.c @@ -2816,7 +2816,10 @@ ecma_op_advance_string_index (ecma_string_t *str_p, /**< input string */ bool is_unicode) /**< true - if regexp object's "unicode" flag is set false - otherwise */ { - JERRY_ASSERT (index < UINT32_MAX - 1); + if (index >= UINT32_MAX - 1) + { + return UINT32_MAX; + } uint32_t next_index = index + 1;