Skip to content

Commit

Permalink
src: check for overflow when extending AliasedBufferBase
Browse files Browse the repository at this point in the history
When resizing an aliased_buffer check if the new size will overflow.

PR-URL: #31740
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
amdoku authored and sbaayel committed Nov 3, 2023
1 parent c0b32af commit e5dbc95
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/aliased_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ class AliasedBufferBase {
const v8::HandleScope handle_scope(isolate_);

const size_t old_size_in_bytes = sizeof(NativeT) * count_;
const size_t new_size_in_bytes = sizeof(NativeT) * new_capacity;
const size_t new_size_in_bytes = MultiplyWithOverflowCheck(sizeof(NativeT),
new_capacity);

// allocate v8 new ArrayBuffer
v8::Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(
Expand Down

0 comments on commit e5dbc95

Please sign in to comment.