We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8d16f0d commit 396342eCopy full SHA for 396342e
src/node_buffer.cc
@@ -494,7 +494,12 @@ MaybeLocal<Object> New(Environment* env,
494
size_t length) {
495
if (length > 0) {
496
CHECK_NOT_NULL(data);
497
- CHECK(length <= kMaxLength);
+ // V8 currently only allows a maximum Typed Array index of max Smi.
498
+ if (length > kMaxLength) {
499
+ Isolate* isolate(env->isolate());
500
+ isolate->ThrowException(ERR_BUFFER_TOO_LARGE(isolate));
501
+ return Local<Object>();
502
+ }
503
}
504
505
auto free_callback = [](char* data, void* hint) { free(data); };
0 commit comments