[Fix] Illegal memory access in GetOutputIndex with optional outputs#27301
Open
qti-mattsinc wants to merge 2 commits intomicrosoft:mainfrom
Open
[Fix] Illegal memory access in GetOutputIndex with optional outputs#27301qti-mattsinc wants to merge 2 commits intomicrosoft:mainfrom
qti-mattsinc wants to merge 2 commits intomicrosoft:mainfrom
Conversation
* When a non-trailing output is optional, its ValueInfo may be nullptr. The current implementation attempts to dereference the nullptr due to a missing check. * This bug is exposed if an EP calls `ValueInfo_GetValueProducer` on a value info whose producer has non-trailing optional outputs. * This commit adds the required check and a unit test.
edgchen1
reviewed
Feb 13, 2026
| gsl::span<const EpValueInfo* const> outputs = producer_node.GetOutputsSpan(); | ||
|
|
||
| for (size_t i = 0; i < outputs.size(); i++) { | ||
| if (outputs[i] == nullptr) { // outputs == nullptr means the output is optional |
Contributor
There was a problem hiding this comment.
Suggested change
| if (outputs[i] == nullptr) { // outputs == nullptr means the output is optional | |
| if (outputs[i] == nullptr) { // outputs[i] == nullptr means the output is a missing optional output |
edgchen1
previously approved these changes
Feb 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
GetOutputIndex.Motivation and Context
GetOutputIndexmay be null. The current implementation attempts to dereference the nullptr due to a missing check.ValueInfo_GetValueProduceron a value info whose producer has non-trailing optional outputs.GetInputIndicesbut not forGetOutputIndex