akaashrp commented on code in PR #20167:
URL: https://github.com/apache/tvm/pull/20167#discussion_r3860060026
##########
web/emcc/wasm_runtime.cc:
##########
@@ -126,38 +128,93 @@ TVM_FFI_STATIC_INIT_BLOCK() {
});
}
+size_t GetCheckedTensorElementCount(const Tensor& tensor) {
Review Comment:
I couldn't find shape validation in the allocation path. `ffi::GetDataSize`
multiplies dimensions as `size_t` without checking negative values or overflow.
This matters on `wasm32`, where an `int64_t` dimension could truncate before
allocation. Since this function is also callable directly through FFI, I think
the checks should remain unless validation is added to the common tensor
construction path.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]