Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 789fef1

Browse filesBrowse files
rayw000BethGriggs
authored andcommitted
src: throw error instead of assertion
PR-URL: #40243 Fixes: #40059 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 91c3cf5 commit 789fef1
Copy full SHA for 789fef1

File tree

Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed
Open diff view settings
Collapse file

‎src/node_buffer.cc‎

Copy file name to clipboardExpand all lines: src/node_buffer.cc
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,12 @@ MaybeLocal<Object> New(Environment* env,
494494
size_t length) {
495495
if (length > 0) {
496496
CHECK_NOT_NULL(data);
497-
CHECK(length <= kMaxLength);
497+
// 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+
}
498503
}
499504

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.