Enforce the wasm memory size limit on heaps with no maximum.

This commit is contained in:
Dan Gohman
2018-08-28 16:51:05 -07:00
parent f2ad79963c
commit c5f0cd7d5e

View File

@@ -57,6 +57,13 @@ impl LinearMemory {
if new_pages > val { if new_pages > val {
return None; return None;
} }
} else {
// Wasm linear memories are never allowed to grow beyond what is
// indexable. If the memory has no maximum, enforce the greatest
// limit here.
if new_pages >= 65536 {
return None;
}
} }
let prev_pages = self.current; let prev_pages = self.current;