Skip to content

Commit 9fbd0cc

Browse files
authored
Fix fast access mode arrays delete property operation (#3073)
The old last element should be released before reallocating the underlying buffer JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
1 parent e04bbdf commit 9fbd0cc

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

jerry-core/ecma/operations/ecma-array-object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ ecma_delete_fast_array_properties (ecma_object_t *object_p, /**< fast access mod
413413
return new_length;
414414
}
415415

416-
for (uint32_t i = new_length; i < old_length - 1; i++)
416+
for (uint32_t i = new_length; i < old_length; i++)
417417
{
418418
if (ecma_is_value_array_hole (values_p[i]))
419419
{
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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 arr = [0, Infinity];
16+
Object.defineProperties(arr, {
17+
length: {
18+
value: 1,
19+
}
20+
});
21+
22+
assert(arr.length === 1);
23+
assert(arr[0] === 0);

0 commit comments

Comments
 (0)