Index: src/wasm/wasm-js.cc |
diff --git a/src/wasm/wasm-js.cc b/src/wasm/wasm-js.cc |
index a3a42cdc99f7af64952099a2b21cc9c839f7f6f8..eea0e756fde377bda7ea38dc307dfdddb176c243 100644 |
--- a/src/wasm/wasm-js.cc |
+++ b/src/wasm/wasm-js.cc |
@@ -151,6 +151,13 @@ i::wasm::ModuleWireBytes GetFirstArgumentAsBytes( |
if (start == nullptr || end == start) { |
thrower->CompileError("BufferSource argument is empty"); |
} |
+ if (end - start > static_cast<ssize_t>(i::wasm::kV8MaxWasmModuleSize)) { |
+ thrower->RangeError("buffer source exceeds maximum size of %" PRId64 |
+ " (is %" PRId64 ")", |
+ static_cast<int64_t>(i::wasm::kV8MaxWasmModuleSize), |
titzer
2017/02/21 15:10:22
for size_t you can use %zu as the format string.
Clemens Hammacher
2017/02/21 17:48:16
Done.
|
+ static_cast<int64_t>(end - start)); |
+ } |
+ if (thrower->error()) return i::wasm::ModuleWireBytes(nullptr, nullptr); |
// TODO(titzer): use the handle as well? |
return i::wasm::ModuleWireBytes(start, end); |
} |