diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-12-09 06:42:10 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-09 06:42:10 -0800 |
commit | 72bacfd46fb0ed4851c22344c3cc632e701ce022 (patch) | |
tree | e8005cd50ff88a8dd689659051c68917b29c91cc /scripts/test/lld.py | |
parent | 42b61e3c2e7851ed001bf26a7e1afab21d0cb38d (diff) | |
download | binaryen-72bacfd46fb0ed4851c22344c3cc632e701ce022.tar.gz binaryen-72bacfd46fb0ed4851c22344c3cc632e701ce022.tar.bz2 binaryen-72bacfd46fb0ed4851c22344c3cc632e701ce022.zip |
Fix comparison of none and unreachable types (#2514)
Currently `none` and `unreachable` types are stored as the same empty
`{}` in src/wasm/wasm-type.cpp. This makes `Type::operator<` incorrectly
when given `none` and `unreachable`, because it expands both given types
and lexicographically compare them, when both of the expanded vector
will be empty.
This was found by the fuzzer. This line in `Modder::visitExpression`
tries to retrieve candidates of the same type. Because we can't really
compare these two types, if you give `unreachable` as the key,
candidates of `none` type can be returned. This generates incorrect code
that ends up failing in validation in a very weird way.
It was hard to generate a small testcase to trigger this part because it
was found by generating fuzzed code from a random data file. But I guess
this fix is pretty straightforward.
Fixes #2512.
Diffstat (limited to 'scripts/test/lld.py')
0 files changed, 0 insertions, 0 deletions