Skip to content

Commit d59b17a

Browse files
Fix invalid assertion condition in jump opcode handlers.
Related issue: #120 JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
1 parent 7d4569a commit d59b17a

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

jerry-core/vm/opcodes-agnostic.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ opfunc_is_true_jmp_down (opcode_t opdata, /**< operation data */
4040

4141
if (ecma_is_completion_value_normal_true (to_bool_completion))
4242
{
43-
JERRY_ASSERT (offset != 0 && ((uint32_t) int_data->pos + offset < MAX_OPCODES));
43+
JERRY_ASSERT ((uint32_t) int_data->pos + offset < MAX_OPCODES);
4444
int_data->pos = (opcode_counter_t) (int_data->pos + offset);
4545
}
4646
else
@@ -73,7 +73,7 @@ opfunc_is_true_jmp_up (opcode_t opdata, /**< operation data */
7373

7474
if (ecma_is_completion_value_normal_true (to_bool_completion))
7575
{
76-
JERRY_ASSERT (offset != 0 && (uint32_t) int_data->pos >= offset);
76+
JERRY_ASSERT ((uint32_t) int_data->pos >= offset);
7777
int_data->pos = (opcode_counter_t) (int_data->pos - offset);
7878
}
7979
else
@@ -112,7 +112,7 @@ opfunc_is_false_jmp_down (opcode_t opdata, /**< operation data */
112112

113113
if (!ecma_is_completion_value_normal_true (to_bool_completion))
114114
{
115-
JERRY_ASSERT (offset != 0 && ((uint32_t) int_data->pos + offset < MAX_OPCODES));
115+
JERRY_ASSERT ((uint32_t) int_data->pos + offset < MAX_OPCODES);
116116
int_data->pos = (opcode_counter_t) (int_data->pos + offset);
117117
}
118118
else
@@ -145,7 +145,7 @@ opfunc_is_false_jmp_up (opcode_t opdata, /**< operation data */
145145

146146
if (!ecma_is_completion_value_normal_true (to_bool_completion))
147147
{
148-
JERRY_ASSERT (offset != 0 && (uint32_t) int_data->pos >= offset);
148+
JERRY_ASSERT ((uint32_t) int_data->pos >= offset);
149149
int_data->pos = (opcode_counter_t) (int_data->pos - offset);
150150
}
151151
else
@@ -173,7 +173,7 @@ opfunc_jmp_down (opcode_t opdata, /**< operation data */
173173
const opcode_counter_t offset = calc_opcode_counter_from_idx_idx (opdata.data.jmp_down.opcode_1,
174174
opdata.data.jmp_down.opcode_2);
175175

176-
JERRY_ASSERT (offset != 0 && ((uint32_t) int_data->pos + offset < MAX_OPCODES));
176+
JERRY_ASSERT (((uint32_t) int_data->pos + offset < MAX_OPCODES));
177177

178178
int_data->pos = (opcode_counter_t) (int_data->pos + offset);
179179

@@ -192,7 +192,7 @@ opfunc_jmp_up (opcode_t opdata, /**< operation data */
192192
{
193193
const opcode_counter_t offset = calc_opcode_counter_from_idx_idx (opdata.data.jmp_up.opcode_1,
194194
opdata.data.jmp_up.opcode_2);
195-
JERRY_ASSERT (offset != 0 && (uint32_t) int_data->pos >= offset);
195+
JERRY_ASSERT ((uint32_t) int_data->pos >= offset);
196196

197197
int_data->pos = (opcode_counter_t) (int_data->pos - offset);
198198

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2015 Samsung Electronics Co., Ltd.
2+
// Copyright 2015 University of Szeged.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
16+
for(;;) {}

0 commit comments

Comments
 (0)