Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1204)

Unified Diff: src/runtime/runtime-wasm.cc

Issue 2288773002: [wasm] Check the input of grow-memory before calling the runtime. (Closed)
Patch Set: Comments. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | test/mjsunit/wasm/grow-memory.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-wasm.cc
diff --git a/src/runtime/runtime-wasm.cc b/src/runtime/runtime-wasm.cc
index c6f214c89888926a011d91f5498d38ee17e73c63..6fc72767ea57bba5cbb4fe9c9be65433ebb4bca0 100644
--- a/src/runtime/runtime-wasm.cc
+++ b/src/runtime/runtime-wasm.cc
@@ -58,9 +58,8 @@ RUNTIME_FUNCTION(Runtime_WasmGrowMemory) {
old_size = 0;
// TODO(gdeepti): Fix bounds check to take into account size of memtype.
new_size = delta_pages * wasm::WasmModule::kPageSize;
- if (delta_pages > wasm::WasmModule::kMaxMemPages) {
- return *isolate->factory()->NewNumberFromInt(-1);
- }
+ // The code generated in the wasm compiler guarantees this precondition.
+ DCHECK(delta_pages <= wasm::WasmModule::kMaxMemPages);
new_mem_start =
static_cast<Address>(isolate->array_buffer_allocator()->Allocate(
static_cast<uint32_t>(new_size)));
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | test/mjsunit/wasm/grow-memory.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698