summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-04-21 07:33:04 -0700
committerGitHub <noreply@github.com>2022-04-21 14:33:04 +0000
commit65f09f262e00348462e3371fbc89c6c1d398fba1 (patch)
tree686a2192e694d6d2d182e8eceb500d8500323424 /src
parent7b6f0d889848fb8031e0d3f2bc801e943ab787e0 (diff)
downloadbinaryen-65f09f262e00348462e3371fbc89c6c1d398fba1.tar.gz
binaryen-65f09f262e00348462e3371fbc89c6c1d398fba1.tar.bz2
binaryen-65f09f262e00348462e3371fbc89c6c1d398fba1.zip
[NominalFuzzing] Fix TranslateToFuzzReader::getSubType(Rtt) (#4604)
Randomly selecting a depth is ok for structural typing, but in nominal it must match the actual hierarchy of types.
Diffstat (limited to 'src')
-rw-r--r--src/tools/fuzzing/fuzzing.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp
index 064871931..467d7f724 100644
--- a/src/tools/fuzzing/fuzzing.cpp
+++ b/src/tools/fuzzing/fuzzing.cpp
@@ -3041,6 +3041,12 @@ HeapType TranslateToFuzzReader::getSubType(HeapType type) {
}
Rtt TranslateToFuzzReader::getSubType(Rtt rtt) {
+ if (getTypeSystem() == TypeSystem::Nominal ||
+ getTypeSystem() == TypeSystem::Isorecursive) {
+ // With nominal or isorecursive typing the depth in rtts must match the
+ // nominal hierarchy, so we cannot create a random depth like we do below.
+ return rtt;
+ }
uint32_t depth = rtt.depth != Rtt::NoDepth
? rtt.depth
: oneIn(2) ? Rtt::NoDepth : upTo(MAX_RTT_DEPTH + 1);