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

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

Issue 2496203002: [wasm] Reimplement function verification in the module decoder. (Closed)
Patch Set: Create a dummy ModuleEnv Created 4 years, 1 month 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-module.cc » ('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 272a60ddaa6383e3503c606352d9d77fb73b2faa..c816fd3bd4acc5fd06fc1780435b5d372ec9fe0f 100644
--- a/src/wasm/module-decoder.cc
+++ b/src/wasm/module-decoder.cc
@@ -586,6 +586,14 @@ class ModuleDecoder : public Decoder {
uint32_t size = consume_u32v("body size");
function->code_start_offset = pc_offset();
function->code_end_offset = pc_offset() + size;
+ if (verify_functions) {
+ ModuleEnv module_env;
+ module_env.module = module;
+ module_env.origin = module->origin;
+
+ VerifyFunctionBody(i + module->num_imported_functions, &module_env,
+ function);
+ }
consume_bytes(size, "function body");
}
section_iter.advance();
@@ -646,6 +654,9 @@ class ModuleDecoder : public Decoder {
}
const WasmModule* finished_module = module;
ModuleResult result = toResult(finished_module);
+ if (verify_functions && result.ok()) {
+ result.MoveFrom(result_); // Copy error code and location.
+ }
if (FLAG_dump_wasm_module) DumpModule(module, result);
return result;
}
« no previous file with comments | « no previous file | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698