diff options
author | Alon Zakai <azakai@google.com> | 2021-04-08 14:55:50 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-08 14:55:50 -0700 |
commit | 1b2fc6dce265a1ff1657cbe43679305311f9e4cf (patch) | |
tree | a89c8494eab709ce4663a7a4b57dbb7d9c0d326e /src | |
parent | 0efebfe68cb0e2759b88093e1811d034ef3e8a79 (diff) | |
download | binaryen-1b2fc6dce265a1ff1657cbe43679305311f9e4cf.tar.gz binaryen-1b2fc6dce265a1ff1657cbe43679305311f9e4cf.tar.bz2 binaryen-1b2fc6dce265a1ff1657cbe43679305311f9e4cf.zip |
Fuzzer: Do not assume table 0 is funcref, as initial content may include a non-funcref table (#3787)
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/fuzzing.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index b5b7671cd..37c027088 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -424,6 +424,8 @@ private: } } + Name funcrefTableName; + // TODO(reference-types): allow the fuzzer to create multiple tables void setupTables() { // Ensure a funcref element segment and table exist. Segments with more @@ -441,6 +443,7 @@ private: tablePtr->hasExplicitName = true; table = wasm.addTable(std::move(tablePtr)); } + funcrefTableName = table->name; bool hasFuncrefElemSegment = std::any_of( wasm.elementSegments.begin(), wasm.elementSegments.end(), @@ -1494,7 +1497,7 @@ private: } // TODO: use a random table return builder.makeCallIndirect( - wasm.tables[0]->name, target, args, targetFn->sig, isReturn); + funcrefTableName, target, args, targetFn->sig, isReturn); } Expression* makeCallRef(Type type) { |