Skip to content

Commit 924f4bb

Browse files
rerobikaakosthekiss
authored andcommitted
Fix the order of value finalizing in ecma_builtin_typedarray_prototype_join (#2726)
This patch fixes #2724. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
1 parent 4c1ee94 commit 924f4bb

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,9 +1052,9 @@ ecma_builtin_typedarray_prototype_join (ecma_value_t this_arg, /**< this argumen
10521052
}
10531053
ecma_free_value (separator_value);
10541054

1055+
ECMA_OP_TO_NUMBER_FINALIZE (length_number);
10551056
ecma_free_value (length_value);
10561057
ecma_free_value (obj_value);
1057-
ECMA_OP_TO_NUMBER_FINALIZE (length_number);
10581058
return ret_value;
10591059
} /* ecma_builtin_typedarray_prototype_join */
10601060

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+
try {
16+
var obj = { reverse : Int32Array.prototype.join } ;
17+
Object.defineProperty( obj, 'length', { 'get' : function(toPrecision) { return Object.create(/x/); }});
18+
obj.reverse("$01$02$11$20");
19+
assert (false);
20+
} catch (e) {
21+
assert (e instanceof TypeError);
22+
}

0 commit comments

Comments
 (0)