Skip to content

Commit f02de7a

Browse files
rerobikaakosthekiss
authored andcommitted
Add missing error check in ecma_builtin_promise_do_all (#2694)
This patch fixes #2693. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
1 parent 2c031c1 commit f02de7a

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,14 @@ ecma_builtin_promise_do_all (ecma_value_t array, /**< the array for all */
470470
/* e. h. */
471471
ecma_string_t *index_to_str_p = ecma_new_ecma_string_from_uint32 (index);
472472
ecma_value_t array_item = ecma_op_object_get (array_p, index_to_str_p);
473+
474+
if (ECMA_IS_VALUE_ERROR (array_item))
475+
{
476+
ecma_deref_ecma_string (index_to_str_p);
477+
ret = array_item;
478+
break;
479+
}
480+
473481
ecma_value_t put_ret = ecma_op_object_put (ecma_get_object_from_value (value_array),
474482
index_to_str_p,
475483
undefined_val,
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, { get : function ( ) { throw $ } });
16+
Promise.all([,]);

0 commit comments

Comments
 (0)