Skip to content

Commit 35ac0e0

Browse files
zherczegyichoi
authored andcommitted
Fix parse_print_final_cbc dump when arguments is used (#2400)
Currently the byte code start is incorrectly set when a non-strict arguments object is present, and a random memory area is dumped as byte code. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
1 parent 03274c1 commit 35ac0e0

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

jerry-core/parser/js/js-parser.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,10 +1228,6 @@ parse_print_final_cbc (ecma_compiled_code_t *compiled_code_p, /**< compiled code
12281228
}
12291229

12301230
byte_code_start_p += (unsigned int) (literal_end - register_end) * sizeof (ecma_value_t);
1231-
if (JERRY_UNLIKELY (compiled_code_p->status_flags & CBC_CODE_FLAGS_NON_STRICT_ARGUMENTS_NEEDED))
1232-
{
1233-
byte_code_start_p += argument_end * sizeof (ecma_value_t);
1234-
}
12351231

12361232
byte_code_end_p = byte_code_start_p + length;
12371233
byte_code_p = byte_code_start_p;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
// Wrong byte codes were dumped for this function when show opcodes had been enabled
16+
17+
function abc(a,b) {
18+
var c = 6;
19+
return arguments[0] + b + c;
20+
}
21+
22+
abc(1, 2);

0 commit comments

Comments
 (0)