Skip to content
Open
Changes from all commits
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
4 changes: 4 additions & 0 deletions src/node_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,10 @@ void CopyArrayBuffer(const FunctionCallbackInfo<Value>& args) {
uint32_t source_offset = args[3].As<Uint32>()->Value();
size_t bytes_to_copy = args[4].As<Uint32>()->Value();

// Assert the offsets are within bounds before the subtractions below, which
// would otherwise underflow and defeat the bytes_to_copy bounds checks.
CHECK_LE(destination_offset, destination_byte_length);
CHECK_LE(source_offset, source_byte_length);
CHECK_GE(destination_byte_length - destination_offset, bytes_to_copy);
CHECK_GE(source_byte_length - source_offset, bytes_to_copy);

Expand Down
Loading