Fix assertion in 're_insert_simple_iterator' (#2209)

It is a followup fix after #2169. It also fixes a memory leak.
This fixes #2198 and fixes #2204

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
László Langó
2018-02-19 08:57:45 +01:00
committed by yichoi
parent c4b61db57a
commit 6fce323fa5
4 changed files with 83 additions and 27 deletions
+6 -6
View File
@@ -16,6 +16,7 @@
#include "ecma-exceptions.h"
#include "ecma-globals.h"
#include "ecma-try-catch-macro.h"
#include "jcontext.h"
#include "jrt-libc-includes.h"
#include "lit-char-helpers.h"
#include "re-compiler.h"
@@ -242,11 +243,6 @@ re_parse_iterator (re_parser_ctx_t *parser_ctx_p, /**< RegExp parser context */
JERRY_ASSERT (ecma_is_value_empty (ret_value));
if (re_token_p->qmin > re_token_p->qmax)
{
ret_value = ecma_raise_syntax_error (ECMA_ERR_MSG ("RegExp quantifier error: qmin > qmax."));
}
return ret_value;
} /* re_parse_iterator */
@@ -893,11 +889,15 @@ re_parse_next_token (re_parser_ctx_t *parser_ctx_p, /**< RegExp parser context *
const lit_utf8_byte_t *input_curr_p = parser_ctx_p->input_curr_p;
lit_utf8_decr (&parser_ctx_p->input_curr_p);
if (ecma_is_value_empty (re_parse_iterator (parser_ctx_p, out_token_p)))
ret_value = re_parse_iterator (parser_ctx_p, out_token_p);
if (ecma_is_value_empty (ret_value))
{
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid RegExp token."));
}
JERRY_ASSERT (ECMA_IS_VALUE_ERROR (ret_value));
ecma_free_value (JERRY_CONTEXT (error_value));
parser_ctx_p->input_curr_p = input_curr_p;
out_token_p->type = RE_TOK_CHAR;