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 addaleax committed Mar 30, 2020
1 parent 575b4e3 commit 8245a78
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 8245a78

Please sign in to comment.