Index: src/wasm/wasm-interpreter.cc |
diff --git a/src/wasm/wasm-interpreter.cc b/src/wasm/wasm-interpreter.cc |
index 94b385033d5110f94692c7fde2978eb63ed93f43..8c23bb2fd8872150f414fcec3e4bfd520b80ea0c 100644 |
--- a/src/wasm/wasm-interpreter.cc |
+++ b/src/wasm/wasm-interpreter.cc |
@@ -658,6 +658,9 @@ static inline int32_t ExecuteGrowMemory(uint32_t delta_pages, |
WasmModuleInstance* instance) { |
// TODO(ahaas): Move memory allocation to wasm-module.cc for better |
// encapsulation. |
+ if (delta_pages > wasm::WasmModule::kMaxMemPages) { |
+ return -1; |
+ } |
uint32_t old_size = instance->mem_size; |
uint32_t new_size; |
byte* new_mem_start; |