summaryrefslogtreecommitdiff
path: root/src/wasm-interpreter.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-04-01 14:15:26 -0700
committerGitHub <noreply@github.com>2024-04-01 14:15:26 -0700
commitf984324d06e3024f742c7fe9c26aac5bbebe3c71 (patch)
tree857b68954fb51eadd2edb08c545fae14d3562038 /src/wasm-interpreter.h
parentfedee9fb559e06db94eb5ae565914d59df5db315 (diff)
downloadbinaryen-f984324d06e3024f742c7fe9c26aac5bbebe3c71.tar.gz
binaryen-f984324d06e3024f742c7fe9c26aac5bbebe3c71.tar.bz2
binaryen-f984324d06e3024f742c7fe9c26aac5bbebe3c71.zip
[Strings] string.new_wtf16_array should trap if the end index is less than the start (#6459)
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r--src/wasm-interpreter.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index 8db33de74..c95f694ef 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -1883,7 +1883,8 @@ public:
const auto& ptrDataValues = ptrData->values;
size_t startVal = start.getSingleValue().getUnsigned();
size_t endVal = end.getSingleValue().getUnsigned();
- if (startVal > ptrDataValues.size() || endVal > ptrDataValues.size()) {
+ if (startVal > ptrDataValues.size() || endVal > ptrDataValues.size() ||
+ endVal < startVal) {
trap("array oob");
}
Literals contents;