Skip to content

Validate the axis of Gather/Slice - #31711

Open
shiyi (shiyi9801) wants to merge 1 commit into
microsoft:mainfrom
shiyi9801:fix_gather_fusion
Open

Validate the axis of Gather/Slice#31711
shiyi (shiyi9801) wants to merge 1 commit into
microsoft:mainfrom
shiyi9801:fix_gather_fusion

Conversation

@shiyi9801

@shiyi9801 shiyi (shiyi9801) commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Description

Validate the axis of Gather/Slice consumers against the input rank in GatherSliceToSplitFusion() before it is used to index the shape's dimensions.

GetGatherAxis and GetSliceAxis previously only normalized a negative axis (axis += rank) and returned it unchecked. ApplyImpl() then did shape->dim(static_cast<int>(axis)) without any bounds check, so an out-of-range axis can lead to an out-of-bounds read of the TensorShapeProto's dim_.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@shiyi9801

Copy link
Copy Markdown
Contributor Author

Scott McKay (@skottmckay) This is a fix for potential vulnerability, PTAL, thanks!

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.

1 participant