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

Unified Diff: src/wasm/module-decoder.cc

Issue 2392943006: [wasm] Implement importing of WebAssembly.Memory. (Closed)
Patch Set: Address review comments Created 4 years, 2 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 | « no previous file | src/wasm/wasm-js.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/module-decoder.cc
diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc
index 4d930a4b38dd0a78fa35a70145b0d4cc8285de8c..6b4861e8ee4112798db35c5c539741a840b16f5d 100644
--- a/src/wasm/module-decoder.cc
+++ b/src/wasm/module-decoder.cc
@@ -310,9 +310,9 @@ class ModuleDecoder : public Decoder {
}
case kExternalMemory: {
// ===== Imported memory =========================================
- // import->index =
- // static_cast<uint32_t>(module->memories.size());
- // TODO(titzer): imported memories
+ consume_resizable_limits(
+ "memory", "pages", WasmModule::kMaxLegalPages,
+ &module->min_mem_pages, &module->max_mem_pages);
break;
}
case kExternalGlobal: {
@@ -774,7 +774,7 @@ class ModuleDecoder : public Decoder {
uint32_t offset = pc_offset();
const byte* string_start = pc_;
// Consume bytes before validation to guarantee that the string is not oob.
- consume_bytes(*length, "string");
+ if (*length > 0) consume_bytes(*length, "string");
if (ok() && validate_utf8 &&
!unibrow::Utf8::Validate(string_start, *length)) {
error(string_start, "no valid UTF-8 string");
« no previous file with comments | « no previous file | src/wasm/wasm-js.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698