onnxruntime
f1fae4c9 - Validate dynamic pads input access (#32654)

Commit
12 days ago
Validate dynamic pads input access (#32654) This pull request strengthens input validation and error handling for the `ConvTransposeWithDynamicPads` operator. The main focus is on ensuring that the required dynamic pads tensor is always provided, both at schema and runtime, and that missing or malformed inputs are handled gracefully. Additionally, a new test is added to verify the operator's behavior when the pads input is missing. **Input validation and schema enforcement:** * The operator schema for `ConvTransposeWithDynamicPads` is updated to make the `Pads` input required instead of optional, ensuring that all usage must provide this tensor. * The shape inference function now immediately returns if fewer than three inputs are provided, preventing access to missing inputs. * In the operator implementation, a check is added to explicitly return an error if the `Pads` tensor is missing when dynamic padding is expected. * The `getInputData` method in `InferenceContextImpl` now safely returns `nullptr` if the requested input index is out of bounds, preventing potential crashes. **Testing improvements:** * A new unit test, `ConvTransposeWithDynamicPads_MissingPadsRejected`, is added to verify that the operator correctly rejects models where the required `Pads` input is missing. **Test infrastructure:** * Includes necessary headers in the test file to support the new test case.
Author
Parents
Loading