summaryrefslogtreecommitdiff
path: root/src/binary-reader-ir.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/binary-reader-ir.cc')
-rw-r--r--src/binary-reader-ir.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/binary-reader-ir.cc b/src/binary-reader-ir.cc
index 97501b57..7563f7e5 100644
--- a/src/binary-reader-ir.cc
+++ b/src/binary-reader-ir.cc
@@ -644,7 +644,13 @@ Result BinaryReaderIR::OnStartFunction(Index func_index) {
}
Result BinaryReaderIR::OnFunctionBodyCount(Index count) {
- assert(module_->num_func_imports + count == module_->funcs.size());
+ // Can hit this case on a malformed module if we don't stop on first error.
+ if (module_->num_func_imports + count != module_->funcs.size()) {
+ PrintError(
+ "number of imported func + func count in code section does not match "
+ "actual number of funcs in module");
+ return Result::Error;
+ }
return Result::Ok;
}