File tree Expand file tree Collapse file tree 3 files changed +7
-0
lines changed Expand file tree Collapse file tree 3 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
17
17
CANNOT_MIX_BIGINT_AND_OTHER_TYPES ,
18
18
DERIVED_CONSTRUCTOR_CREATED_TYPEDARRAY_OBJECT_WHICH_WAS_TOO_SMALL_LENGTH ,
19
19
ITERATOR_PROPERTY_IS_NOT_CALLABLE ,
20
+ MAXIMUM_ALLOWED_LENGTH_EXCEEDED ,
20
21
OFFSET_IS_OUT_OF_BOUNDS ,
21
22
REDUCE_OF_EMPTY_ARRAY_WITH_NO_INITIAL_VALUE ,
22
23
SPECIES_CONSTRUCTOR_DIDNT_RETURN_TYPEDARRAY_OBJECT ,
@@ -38,6 +39,7 @@ import {
38
39
NativeWeakMap ,
39
40
NativeWeakSet ,
40
41
NumberIsNaN ,
42
+ NumberMAX_SAFE_INTEGER ,
41
43
ObjectDefineProperty ,
42
44
ObjectFreeze ,
43
45
ObjectHasOwn ,
@@ -1067,6 +1069,9 @@ export class Float16Array {
1067
1069
1068
1070
// don't use SpeciesConstructor
1069
1071
const newLength = length + insertCount - actualDeleteCount ;
1072
+ if ( newLength > NumberMAX_SAFE_INTEGER ) {
1073
+ throw NativeTypeError ( MAXIMUM_ALLOWED_LENGTH_EXCEEDED ) ;
1074
+ }
1070
1075
const proxy = new Float16Array ( newLength ) ;
1071
1076
const array = getFloat16BitsArray ( proxy ) ;
1072
1077
Original file line number Diff line number Diff line change @@ -19,4 +19,5 @@ export const CANNOT_MIX_BIGINT_AND_OTHER_TYPES =
19
19
export const ITERATOR_PROPERTY_IS_NOT_CALLABLE = "@@iterator property is not callable" ;
20
20
export const REDUCE_OF_EMPTY_ARRAY_WITH_NO_INITIAL_VALUE =
21
21
"Reduce of empty array with no initial value" ;
22
+ export const MAXIMUM_ALLOWED_LENGTH_EXCEEDED = "Maximum allowed length exceeded" ;
22
23
export const OFFSET_IS_OUT_OF_BOUNDS = "Offset is out of bounds" ;
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ export const NativeNumber = Number;
42
42
export const {
43
43
isFinite : NumberIsFinite ,
44
44
isNaN : NumberIsNaN ,
45
+ MAX_SAFE_INTEGER : NumberMAX_SAFE_INTEGER ,
45
46
} = NativeNumber ;
46
47
47
48
// Symbol
You can’t perform that action at this time.
0 commit comments