summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-10-08 16:00:20 -0700
committerGitHub <noreply@github.com>2020-10-08 16:00:20 -0700
commitc8661e115309626a87708cb25067b6a3210367fe (patch)
treeb46ab556fdb31bb11006ffe31e77f80ccb040468 /src
parentd68896d8c54f538c04d4fe43825a63ba135ed0fe (diff)
downloadbinaryen-c8661e115309626a87708cb25067b6a3210367fe.tar.gz
binaryen-c8661e115309626a87708cb25067b6a3210367fe.tar.bz2
binaryen-c8661e115309626a87708cb25067b6a3210367fe.zip
Fuzz fix for DuplicateFunctionElimination (#3204)
The replaceFunctions utility replaced exports by name, but did not check the kind, so it could get confused when names happen to overlap.
Diffstat (limited to 'src')
-rw-r--r--src/passes/opt-utils.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/passes/opt-utils.h b/src/passes/opt-utils.h
index 7912a7d92..cc0f40c54 100644
--- a/src/passes/opt-utils.h
+++ b/src/passes/opt-utils.h
@@ -97,7 +97,9 @@ inline void replaceFunctions(PassRunner* runner,
}
// replace in exports
for (auto& exp : module.exports) {
- maybeReplace(exp->value);
+ if (exp->kind == ExternalKind::Function) {
+ maybeReplace(exp->value);
+ }
}
}