We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 119525e commit 85e95e3Copy full SHA for 85e95e3
src/wasm/wasm-binary.cpp
@@ -967,6 +967,9 @@ void WasmBinaryBuilder::readSignatures() {
967
}
968
969
Name WasmBinaryBuilder::getFunctionIndexName(Index i) {
970
+ if (i >= wasm.functions.size()) {
971
+ throwError("invalid function index");
972
+ }
973
return wasm.functions[i]->name;
974
975
@@ -1505,9 +1508,6 @@ void WasmBinaryBuilder::processFunctions() {
1505
1508
auto index = exportIndexes[curr];
1506
1509
switch (curr->kind) {
1507
1510
case ExternalKind::Function: {
- if (index >= wasm.functions.size()) {
- throwError("bad function export index");
- }
1511
curr->value = getFunctionIndexName(index);
1512
break;
1513
0 commit comments