onnxruntime
3cee1860 - Handle RNN activation parameters safely (#31675)

Commit
32 days ago
Handle RNN activation parameters safely (#31675) This pull request prevents out-of-bounds reads of RNN activation parameters while preserving ONNX-spec-legal attribute lists. **RNN activation parameter handling:** * Reuses the shared `rnn::detail::ActivationFuncs` normalization already used by ORT's LSTM and GRU kernels. * Consumes `activation_alpha` and `activation_beta` values only for activation functions that require them. * Applies activation-specific ONNX defaults when a required value is absent, including `LeakyRelu`, `HardSigmoid`, and `Elu` defaults. * Safely accepts empty, shorter, and longer parameter lists without indexing those lists by direction. **Unit test coverage:** * Verifies mixed activations consume only the required alpha and beta values. * Verifies empty parameter attributes use activation-specific defaults. * Verifies a missing `LeakyRelu` alpha uses the ONNX default of `0.01`. * Verifies extra alpha and beta entries are safely ignored. The tests run explicitly on the CPU execution provider and no longer contain an unrelated DML skip. --------- Co-authored-by: Copilot <223556219@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Author
Parents
Loading