Skip to content

Commit 072aedb

Browse files
szilagyiadamdbatyai
authored andcommitted
Fix wrong error handling in ecma_builtin_function_helper_get_function_arguments (#3257)
Fixes #3252 JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
1 parent eebbed1 commit 072aedb

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

jerry-core/ecma/builtin-objects/ecma-builtin-function.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,7 @@ ecma_builtin_function_helper_get_function_arguments (const ecma_value_t *argumen
9898
if (JERRY_UNLIKELY (new_str_p == NULL))
9999
{
100100
ecma_deref_ecma_string (final_str_p);
101-
102-
/* Return with the error. */
103-
final_str_p = new_str_p;
104-
break;
101+
return ECMA_VALUE_ERROR;
105102
}
106103

107104
final_str_p = ecma_append_magic_string_to_string (final_str_p,
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright JS Foundation and other contributors, http://js.foundation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
try {
16+
function NoParent ( ) { }
17+
Number.constructor( NoParent, Symbol.hasInstance, { })
18+
assert (false)
19+
} catch (e) {
20+
assert (e instanceof TypeError);
21+
}

0 commit comments

Comments
 (0)