Skip to content

Commit

Permalink
Fix invalid index checking in readImports (#2758)
Browse files Browse the repository at this point in the history
Fixes #2751.
  • Loading branch information
aheejin authored Apr 13, 2020
1 parent 13efc1e commit 585f817
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wasm/wasm-binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@ void WasmBinaryBuilder::readImports() {
case ExternalKind::Function: {
auto name = Name(std::string("fimport$") + std::to_string(i));
auto index = getU32LEB();
if (index > signatures.size()) {
if (index >= signatures.size()) {
throwError("invalid function index " + std::to_string(index) + " / " +
std::to_string(signatures.size()));
}
Expand Down

0 comments on commit 585f817

Please sign in to comment.