Index: src/wasm/module-decoder.cc |
diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc |
index d7c7954de2e5d700121aad968d676e193d21d163..f8541d319ea0e7efed51b98772d02f949a8131d2 100644 |
--- a/src/wasm/module-decoder.cc |
+++ b/src/wasm/module-decoder.cc |
@@ -457,7 +457,11 @@ class ModuleDecoder : public Decoder { |
} |
case kExternalMemory: { |
uint32_t index = consume_u32v("memory index"); |
- if (index != 0) error("invalid memory index != 0"); |
+ // TODO(titzer): This should become more regular |
+ // once we support multiple memories. |
+ if (!module->has_memory || index != 0) { |
+ error("invalid memory index != 0"); |
+ } |
module->mem_export = true; |
break; |
} |