Skip to content

Commit ad7fc07

Browse files
authored
Add missing error check for for-in HasNext check (#4471)
This patch fixes #4464. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
1 parent b0ca537 commit ad7fc07

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

jerry-core/vm/vm.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4036,6 +4036,11 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
40364036

40374037
result = ecma_op_object_has_property (object_p, prop_name_p);
40384038

4039+
if (ECMA_IS_VALUE_ERROR (result))
4040+
{
4041+
goto error;
4042+
}
4043+
40394044
if (JERRY_LIKELY (ecma_is_value_true (result)))
40404045
{
40414046
byte_code_p = byte_code_start_p + branch_offset;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
var a = [3.3, 2.2, 1];
16+
17+
try {
18+
a.sort(function() {
19+
var o = new Proxy({
20+
get foo() {
21+
return eval("function");
22+
},
23+
set foo(arg) {
24+
return s2 = s3
25+
}
26+
}, {
27+
has: true,
28+
get: function() {
29+
a = true;
30+
return 30;
31+
}
32+
});
33+
o.x = 43;
34+
var result = "";
35+
for (var p in o)
36+
result += o[p];
37+
});
38+
assert(false);
39+
} catch (e) {
40+
assert(e instanceof TypeError);
41+
}

0 commit comments

Comments
 (0)