diff options
author | Alon Zakai <azakai@google.com> | 2022-05-23 12:44:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-23 19:44:52 +0000 |
commit | a78d0e44cbcc72682ab9c45dec76d4b1c52588c9 (patch) | |
tree | 8362d3ca459b5c048a7e539eb63e5738f5c18b06 /src/passes/SignatureRefining.cpp | |
parent | fa3ffd0c2697fde7705495b52b139f7939f97925 (diff) | |
download | binaryen-a78d0e44cbcc72682ab9c45dec76d4b1c52588c9.tar.gz binaryen-a78d0e44cbcc72682ab9c45dec76d4b1c52588c9.tar.bz2 binaryen-a78d0e44cbcc72682ab9c45dec76d4b1c52588c9.zip |
[Nominal Fuzzing] Fix SignatureRefining by updating types fully at once (#4665)
Optionally avoid updating types in TypeUpdating::updateParamTypes(). That update
is incomplete if the function signature is also changing, which is the case in
SignatureRefining (but not DeadArgumentElimination). "Incomplete" means that
we updated the local.get type, but the function signature does not match yet. That
incomplete state can hit an internal error in GlobalTypeRewriter::updateSignatures
where it updates types. To avoid that, do the entire full update only there (in
GlobalTypeRewriter::updateSignatures).
Diffstat (limited to 'src/passes/SignatureRefining.cpp')
-rw-r--r-- | src/passes/SignatureRefining.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/passes/SignatureRefining.cpp b/src/passes/SignatureRefining.cpp index 2c2146c3f..bde1c4fb9 100644 --- a/src/passes/SignatureRefining.cpp +++ b/src/passes/SignatureRefining.cpp @@ -243,7 +243,15 @@ struct SignatureRefining : public Pass { for (auto param : iter->second.params) { newParamsTypes.push_back(param); } - TypeUpdating::updateParamTypes(func, newParamsTypes, wasm); + // Do not update local.get/local.tee here, as we will do so in + // GlobalTypeRewriter::updateSignatures, below. (Doing an update here + // would leave the IR in an inconsistent state of a partial update; + // instead, do the full update at the end.) + TypeUpdating::updateParamTypes( + func, + newParamsTypes, + wasm, + TypeUpdating::LocalUpdatingMode::DoNotUpdate); } } }; |