Skip to content

ORT 1.17.1 Cherry Picks - #28298

Closed
adrastogi wants to merge 1 commit into
rel-1.17.1from
adrastogi/rel-1.17.1-cherry-pick
Closed

adrastogi wants to merge 1 commit into
rel-1.17.1from
adrastogi/rel-1.17.1-cherry-pick

Conversation

@adrastogi

Copy link
Copy Markdown
Contributor

This cherry-picks the following commits for the release:

#27444 Fix GatherCopyData Integer Truncation Leading to Heap Out-of-Bounds Read/Write

…ead/Write (#27444)

### Description
This pull request improves the robustness and correctness of the CPU
implementation of the Gather operator in ONNX Runtime. The key changes
focus on preventing integer overflow issues in parallel processing and
output shape calculations, as well as enhancing test coverage to verify
these safeguards.

Enhancements to overflow handling and parallel processing:

* Changed the lambda function in `GatherCopyData` to use `ptrdiff_t`
instead of `int64_t` for the index, and explicitly cast batch and i
variables, ensuring safer arithmetic for large tensor sizes.
* Updated the parallel loop in `GatherCopyData` to iterate using
`ptrdiff_t` indices, preventing potential overflow when processing large
tensors.

Testing improvements:

* Added a new unit test `Gather_overflow_check` in `gather_op_test.cc`
to verify that the Gather operator correctly handles very large output
shapes without overflowing, specifically testing dimensions that exceed
the 32-bit integer limit.



### 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. -->
@tianleiwu

Tianlei Wu (tianleiwu) commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

It is not possible to refresh existed 1.17.1 packages in pypi or nuget, so we shall not change rel-1.17.1 branch.

If you really need a patch, consider creating rel-1.17.2 branch (but package pipelines in that branch likely does not work anymore).

We've fixed maybe hundreds of security issues since 1.17.1. I do not see much value to add one fix to 1.17.1. Recommend to upgrade to latest version if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants