Fix issue#2445 Null Pointer Deref#2461
Conversation
| } | ||
| *module = std::move(*m.get()); | ||
| if (m) { | ||
| *module = std::move(*m.get()); |
There was a problem hiding this comment.
Is it possible for ParseWatModule above to succeed without *m being set?
Would this work instead:
if (errors.length()) {
return Result::Error;
}
assert(*m);
There was a problem hiding this comment.
doesn't ParseWatModule also return a Result? probably a good idea to check that instead.
There was a problem hiding this comment.
Yes that sounds good. You can do something like this
if (Failed(ParseWatModule(lexer.get(), &m, &errors, options_)) {
for (const auto& error : errors) {
...
}
return Result::Error;
}
assert(errors.length == 0);
|
Hi, And ASAN is not triggered. Do you think we should make some further improvements about it? |
|
It would be good to add that as a test case I think. Seems like the kind of test that could also be upstreamed to the wasm spec test suite too (once it lands here). |
|
If I want to add it into test case, should I directly add a .txt file to https://github.com/WebAssembly/wabt/tree/main/test/parse? |
|
the test looks great. wonder if it would make sense to upstream it... |
|
ParseWatModule returns a Result, it would be a good idea to check that Result. |
Fix issue 2445:
#2445