Skip to content

Commit 425cd4d

Browse files
authored
[Fuzzer] Do not make local.get without function context (#7813)
The fuzzer tries to finish quickly by falling back to creating local.gets or constants after it reaches the end of its random input. The former option should only be used inside a funtion context, though.
1 parent 91f38e9 commit 425cd4d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tools/fuzzing/fuzzing.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,12 +2066,13 @@ Expression* TranslateToFuzzReader::make(Type type) {
20662066
nesting >= 5 * fuzzParams->NESTING_LIMIT || // hard limit
20672067
(nesting >= fuzzParams->NESTING_LIMIT && !oneIn(3))) {
20682068
if (type.isConcrete()) {
2069-
if (oneIn(2)) {
2069+
if (!funcContext || oneIn(2)) {
20702070
return makeConst(type);
20712071
} else {
20722072
return makeLocalGet(type);
20732073
}
20742074
} else if (type == Type::none) {
2075+
assert(funcContext);
20752076
if (oneIn(2)) {
20762077
return makeNop(type);
20772078
} else {

0 commit comments

Comments
 (0)