Canonicalize external data locations - #32135
Merged
Akshay Sonawane (apsonawane) merged 2 commits intoAug 20, 2026
Merged
Conversation
Akshay Sonawane (apsonawane)
enabled auto-merge (squash)
August 17, 2026 21:08
Copilot started reviewing on behalf of
Akshay Sonawane (apsonawane)
August 17, 2026 21:10
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Strengthens external tensor-data handling by rejecting ambiguous locations and preventing internal memory tags from being interpreted as file paths.
Changes:
- Rejects duplicate or empty external-data locations.
- Detects memory tags across all location entries.
- Adds path-validation and parsing tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
onnxruntime/core/framework/tensor_external_data_info.cc |
Validates location uniqueness and non-emptiness. |
onnxruntime/core/framework/tensorprotoutils.cc |
Improves memory-tag detection and path rejection. |
onnxruntime/test/framework/tensorutils_test.cc |
Covers duplicate locations and memory-tag validation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Ti-Tai Wang (titaiwangms)
approved these changes
Aug 20, 2026
Akshay Sonawane (apsonawane)
deleted the
fix/external-data-location-canonicalization
branch
August 20, 2026 17:53
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.
This pull request improves the robustness and correctness of handling external data references in ONNX Runtime, particularly focusing on rejecting invalid or ambiguous "location" entries and ensuring in-memory reference tags are not treated as file paths. The changes also enhance path validation logic and add new unit tests to cover these scenarios.
Validation and error handling improvements:
ExternalDataInfo::Createto reject duplicate "location" entries in the external data info, ensuring only one "location" is allowed per tensor. [1] [2]ValidateExternalDataPathFromDirandValidateExternalDataPathto explicitly reject in-memory reference tags (used for internal memory mapping) as invalid file paths, alongside empty and absolute paths. [1] [2] [3] [4] [5] [6]Functionality and code clarity:
HasExternalDataInMemoryto correctly detect in-memory references even if there are multiple "location" entries, improving reliability.Testing enhancements:
These changes collectively strengthen the validation of external data references, prevent ambiguous or invalid configurations, and ensure that in-memory tags are never misinterpreted as file paths.