diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2022-05-16 10:55:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-16 10:55:35 -0700 |
commit | cc0d5fcfcdc4740793816531c89e30ec56823777 (patch) | |
tree | 5798b1b39cc3e0174ad09509836de09412f991c0 /src | |
parent | 4edfcc9f8cfc6a340411b791e7d7889b836dc772 (diff) | |
download | binaryen-cc0d5fcfcdc4740793816531c89e30ec56823777.tar.gz binaryen-cc0d5fcfcdc4740793816531c89e30ec56823777.tar.bz2 binaryen-cc0d5fcfcdc4740793816531c89e30ec56823777.zip |
Allow TypeBuilder::grow to take 0 as an argument (#4668)
There's no reason not to allow growing by zero slots, but previously doing so
would trigger an assertion. This caused a crash when roundtripping a trivial
module.
Fixes #4667.
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm/wasm-type.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp index a9ce30e15..b3dd61a8e 100644 --- a/src/wasm/wasm-type.cpp +++ b/src/wasm/wasm-type.cpp @@ -2810,7 +2810,7 @@ TypeBuilder::TypeBuilder(TypeBuilder&& other) = default; TypeBuilder& TypeBuilder::operator=(TypeBuilder&& other) = default; void TypeBuilder::grow(size_t n) { - assert(size() + n > size()); + assert(size() + n >= size()); impl->entries.resize(size() + n); } |