summaryrefslogtreecommitdiff
path: root/src/ir/names.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-03-12 12:20:36 -0800
committerGitHub <noreply@github.com>2021-03-12 12:20:36 -0800
commitd31f202cf860ba8690db2f4c3d521dfc6a178b5c (patch)
tree76fe0aea1105595e17386830d90c5e87a173d48c /src/ir/names.h
parent486f2611be3aefae0079de3c566474c9ed87a320 (diff)
downloadbinaryen-d31f202cf860ba8690db2f4c3d521dfc6a178b5c.tar.gz
binaryen-d31f202cf860ba8690db2f4c3d521dfc6a178b5c.tar.bz2
binaryen-d31f202cf860ba8690db2f4c3d521dfc6a178b5c.zip
Fix fuzz issue with ElementSegment name collisions (#3674)
Now that they have names they can collide. All the fuzzer wants is to ensure there is a segment to add to, so if there is one, do not add another.
Diffstat (limited to 'src/ir/names.h')
-rw-r--r--src/ir/names.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ir/names.h b/src/ir/names.h
index 6fbb987f5..94efd91d4 100644
--- a/src/ir/names.h
+++ b/src/ir/names.h
@@ -84,6 +84,11 @@ inline Name getValidEventName(Module& module, Name root) {
return getValidName(
module, root, [&](Name test) { return !module.getEventOrNull(test); });
}
+inline Name getValidElementSegmentName(Module& module, Name root) {
+ return getValidName(module, root, [&](Name test) {
+ return !module.getElementSegmentOrNull(test);
+ });
+}
} // namespace Names