Skip to content

Commit 28cfaa8

Browse files
amdokutargos
authored andcommittedApr 22, 2020
src: check for overflow when extending AliasedBufferBase
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>
1 parent afc0c70 commit 28cfaa8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/aliased_buffer.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ class AliasedBufferBase {
221221
const v8::HandleScope handle_scope(isolate_);
222222

223223
const size_t old_size_in_bytes = sizeof(NativeT) * count_;
224-
const size_t new_size_in_bytes = sizeof(NativeT) * new_capacity;
224+
const size_t new_size_in_bytes = MultiplyWithOverflowCheck(sizeof(NativeT),
225+
new_capacity);
225226

226227
// allocate v8 new ArrayBuffer
227228
v8::Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(

0 commit comments

Comments
 (0)
Please sign in to comment.