Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
src: throw error instead of assertion
  • Loading branch information
rayw000 committed Sep 28, 2021
commit 1534112c8b9f16eb70b0441acae8c1915946f9ed
7 changes: 6 additions & 1 deletion src/node_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,12 @@ MaybeLocal<Object> New(Environment* env,
size_t length) {
if (length > 0) {
CHECK_NOT_NULL(data);
CHECK(length <= kMaxLength);
// V8 currently only allows a maximum Typed Array index of max Smi.
if (length > kMaxLength) {
Isolate* isolate(env->isolate());
isolate->ThrowException(ERR_BUFFER_TOO_LARGE(isolate));
return Local<Object>();
}
}

auto free_callback = [](char* data, void* hint) { free(data); };
Expand Down