diff options
author | Alon Zakai <azakai@google.com> | 2021-03-25 15:58:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-25 15:58:56 -0700 |
commit | 36d6f22cf71e66847fb06685b0e634fe0c4f770d (patch) | |
tree | bf84bf119955b4760671c83f950748282b4e1d51 /src/tools/wasm-reduce.cpp | |
parent | c248d90bdc2f439ed04b89aff408412dd7711f1f (diff) | |
download | binaryen-36d6f22cf71e66847fb06685b0e634fe0c4f770d.tar.gz binaryen-36d6f22cf71e66847fb06685b0e634fe0c4f770d.tar.bz2 binaryen-36d6f22cf71e66847fb06685b0e634fe0c4f770d.zip |
Print parse errors in reducer and roundtrip (#3737)
Without this, crashes from things like #3736 simply get reported as
"a parse exception was thrown" with no detail.
Diffstat (limited to 'src/tools/wasm-reduce.cpp')
-rw-r--r-- | src/tools/wasm-reduce.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp index 19afc2032..95e315e96 100644 --- a/src/tools/wasm-reduce.cpp +++ b/src/tools/wasm-reduce.cpp @@ -347,7 +347,13 @@ struct Reducer void loadWorking() { module = make_unique<Module>(); ModuleReader reader; - reader.read(working, *module); + try { + reader.read(working, *module); + } catch (ParseException& p) { + p.dump(std::cerr); + std::cerr << '\n'; + Fatal() << "error in parsing working wasm binary"; + } // If there is no features section, assume we may need them all (without // this, a module with no features section but that uses e.g. atomics and // bulk memory would not work). |