Commit af35e0a3 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[arraybuffer] Set DataHandle length only if data is provided

When the DataHandle is created in ArrayBufferContents::CreateDataHandle,
the provided {data} allocated with AllocateMemoryOrNull can be nullptr.
If so, we don't want to store the length in the new DataHandle. To avoid
an inconsistent state.

R=haraken@chromium.org

Bug: chromium:1008840
Change-Id: Ia9bb106a82b5c2f884b8a4e09ebd4f6ca0be9152
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1865220Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706857}
parent 3ffd2aae
...@@ -64,7 +64,7 @@ class WTF_EXPORT ArrayBufferContents { ...@@ -64,7 +64,7 @@ class WTF_EXPORT ArrayBufferContents {
DataDeleter deleter, DataDeleter deleter,
void* deleter_info) void* deleter_info)
: data_(data), : data_(data),
data_length_(length), data_length_(data ? length : 0),
deleter_(deleter), deleter_(deleter),
deleter_info_(deleter_info) {} deleter_info_(deleter_info) {}
// Move constructor // Move constructor
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment