Skip to content

Commit 8f64339

Browse files
Daniel Ballaakosthekiss
authored andcommitted
Fix ecma_op_object_put return value not being handled (#2514)
Fixes #2487 Fixes #2488 Co-authored-by: Robert Fancsik [email protected] JerryScript-DCO-1.0-Signed-off-by: Daniel Balla [email protected]
1 parent 99c9a22 commit 8f64339

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,11 +459,18 @@ ecma_builtin_promise_do_all (ecma_value_t array, /**< the array for all */
459459
/* e. h. */
460460
ecma_string_t *index_to_str_p = ecma_new_ecma_string_from_uint32 (index);
461461
ecma_value_t array_item = ecma_op_object_get (array_p, index_to_str_p);
462-
ecma_op_object_put (ecma_get_object_from_value (value_array),
463-
index_to_str_p,
464-
undefined_val,
465-
false);
462+
ecma_value_t put_ret = ecma_op_object_put (ecma_get_object_from_value (value_array),
463+
index_to_str_p,
464+
undefined_val,
465+
false);
466466
ecma_deref_ecma_string (index_to_str_p);
467+
468+
if (ECMA_IS_VALUE_ERROR (put_ret))
469+
{
470+
ret = put_ret;
471+
break;
472+
}
473+
467474
/* i. */
468475
ecma_value_t next_promise = ecma_builtin_promise_resolve (ctor, array_item);
469476
ecma_free_value (array_item);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
Object.defineProperty(Array.prototype, 0, {set: function() {var $ = $()}});
16+
Promise.all([0]);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
Object.defineProperty(Array.prototype, 0, {set: function() {throw "MyError"}});
16+
Promise.all([0]);

0 commit comments

Comments
 (0)