onnxruntime
4dfcacc9 - Validate constant tensor byte size in DML OnnxTensorWrapper (#31665)

Commit
4 days ago
Validate constant tensor byte size in DML OnnxTensorWrapper (#31665) ### Description <!-- Describe your changes. --> Adds a bounds check to the DML EP's `OnnxTensorWrapper` so that a `TensorProto` whose declared shape implies more data than its backing buffer actually holds is rejected at construction, instead of being handed to operator kernels. - New helper `VerifyTensorProtoFitsInBuffer` in `MLOperatorAuthorImpl.cpp` computes the byte size implied by the tensor's dims and element type, and fails with `E_INVALIDARG` when the buffer is smaller - Called at the end of the `OnnxTensorWrapper` constructor, covering the `raw_data`, typed-field, and external-data paths - Adds `onnxruntime/test/providers/dml_onnx_tensor_wrapper_test.cc` with positive / negative cases. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> DML reliability improvement. --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Author
Parents
Loading