summaryrefslogtreecommitdiff
path: root/deps/v8/src/builtins/typed-array-sort.tq
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/builtins/typed-array-sort.tq')
-rw-r--r--deps/v8/src/builtins/typed-array-sort.tq8
1 files changed, 8 insertions, 0 deletions
diff --git a/deps/v8/src/builtins/typed-array-sort.tq b/deps/v8/src/builtins/typed-array-sort.tq
index c32808038d..614852f444 100644
--- a/deps/v8/src/builtins/typed-array-sort.tq
+++ b/deps/v8/src/builtins/typed-array-sort.tq
@@ -114,6 +114,14 @@ transitioning javascript builtin TypedArrayPrototypeSort(
return TypedArraySortFast(context, obj);
}
+ // Throw rather than crash if the TypedArray's size exceeds max FixedArray
+ // size (which we need below).
+ // TODO(4153): Consider redesigning the sort implementation such that we
+ // don't have such a limit.
+ if (len > kFixedArrayMaxLength) {
+ ThrowTypeError(MessageTemplate::kTypedArrayTooLargeToSort);
+ }
+
const comparefn: Callable =
Cast<Callable>(comparefnObj) otherwise unreachable;
const accessor: TypedArrayAccessor =