Commit 3f6f42c5 authored by Deepti Gandluri's avatar Deepti Gandluri Committed by Commit Bot

[wasm] Propagate failure to grow when SetPermissions fails

Change-Id: Icea792696458bfa0568ac92c15a7f4523f88849d
Reviewed-on: https://chromium-review.googlesource.com/952570Reviewed-by: 's avatarEric Holk <eholk@chromium.org>
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51792}
parent ae314567
......@@ -454,8 +454,12 @@ Handle<JSArrayBuffer> GrowMemoryBuffer(Isolate* isolate,
old_size != 0) {
DCHECK_NOT_NULL(old_buffer->backing_store());
if (old_size != new_size) {
CHECK(i::SetPermissions(old_mem_start, new_size,
PageAllocator::kReadWrite));
// If adjusting permissions fails, propagate error back to return
// failure to grow.
if (!i::SetPermissions(old_mem_start, new_size,
PageAllocator::kReadWrite)) {
return Handle<JSArrayBuffer>::null();
}
reinterpret_cast<v8::Isolate*>(isolate)
->AdjustAmountOfExternalAllocatedMemory(pages * wasm::kWasmPageSize);
}
......
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