summaryrefslogtreecommitdiff
path: root/src/wasm-interpreter.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-03-25 14:55:58 -0700
committerGitHub <noreply@github.com>2024-03-25 14:55:58 -0700
commit1125750c47890935eb1271491d765e46ea66b07c (patch)
treef15d2ed710a6c5aa6c2cd41ed7848f01243930e7 /src/wasm-interpreter.h
parent47bcca6783b64b64560b1c1196a1f5e1a98e108a (diff)
downloadbinaryen-1125750c47890935eb1271491d765e46ea66b07c.tar.gz
binaryen-1125750c47890935eb1271491d765e46ea66b07c.tar.bz2
binaryen-1125750c47890935eb1271491d765e46ea66b07c.zip
StringNew: Trap on OOB start index (#6438)
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r--src/wasm-interpreter.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index f34cb83be..377eb9465 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -1883,7 +1883,7 @@ public:
const auto& ptrDataValues = ptrData->values;
size_t startVal = start.getSingleValue().getUnsigned();
size_t endVal = end.getSingleValue().getUnsigned();
- if (endVal > ptrDataValues.size()) {
+ if (startVal > ptrDataValues.size() || endVal > ptrDataValues.size()) {
trap("array oob");
}
Literals contents;