src: check for overflow when extending AliasedBufferBase

When resizing an aliased_buffer check if the new size will overflow.

PR-URL: https://github.com/nodejs/node/pull/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>
pull/32563/head
Christian Niederer 2020-02-11 16:27:19 +01:00 committed by Anna Henningsen
parent 575b4e368d
commit 8245a7816c
No known key found for this signature in database
GPG Key ID: A94130F0BFC8EBE9
1 changed files with 2 additions and 1 deletions

View File

@ -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(