Free scanner info even if for statement parsing is failed. (#3141)
Fixes #3140. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
committed by
Dániel Bátyai
parent
5c7df1cb2d
commit
f2013fcb1a
@@ -1064,6 +1064,13 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
|
||||
if (context_p->next_scanner_info_p->source_p != context_p->source_p
|
||||
|| ((scanner_for_info_t *) context_p->next_scanner_info_p)->end_location.source_p == NULL)
|
||||
{
|
||||
if (context_p->next_scanner_info_p->source_p == context_p->source_p)
|
||||
{
|
||||
/* Even though the scanning is failed, there might be valid statements
|
||||
* inside the for statement which depend on scanner info blocks. */
|
||||
scanner_release_next (context_p, sizeof (parser_for_statement_t));
|
||||
}
|
||||
|
||||
/* The prescanner couldn't find the second semicolon or the closing paranthesis. */
|
||||
lexer_next_token (context_p);
|
||||
parser_parse_expression (context_p, PARSE_EXPR);
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
for (; []; [//])
|
||||
function f14(v33, v34) {
|
||||
switch (!0x13) {}
|
||||
}
|
||||
Reference in New Issue
Block a user