diff options
author | Alon Zakai <azakai@google.com> | 2024-05-01 09:52:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-01 09:52:14 -0700 |
commit | 58753f40d9ee51bbe5c3acb7656e0d4ab73d0f36 (patch) | |
tree | 5a0278ceb050feee6e29f4d087d96b8457682c5f /src/wasm-interpreter.h | |
parent | 7d9e4a87ce4949dc552790329cfaf4dfec8b36a8 (diff) | |
download | binaryen-58753f40d9ee51bbe5c3acb7656e0d4ab73d0f36.tar.gz binaryen-58753f40d9ee51bbe5c3acb7656e0d4ab73d0f36.tar.bz2 binaryen-58753f40d9ee51bbe5c3acb7656e0d4ab73d0f36.zip |
Respect the Web limitation on Table size (#6567)
Without this the fuzzer can error on differences in behavior between V8 and us.
Also move the limitations constants to their own header.
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r-- | src/wasm-interpreter.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 059f2d950..a9bba774b 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -35,6 +35,7 @@ #include "support/stdckdint.h" #include "support/string.h" #include "wasm-builder.h" +#include "wasm-limits.h" #include "wasm-traversal.h" #include "wasm.h" @@ -3138,6 +3139,9 @@ public: return fail; } Index newSize = tableSize + delta; + if (newSize > WebLimitations::MaxTableSize) { + return fail; + } if (!info.interface->growTable( tableName, valueFlow.getSingleValue(), tableSize, newSize)) { // We failed to grow the table in practice, even though it was valid |