Repository navigation
Fix out-of-bounds read in EmbedLayerNormalization shape inference for scalar beta - #32610
Merged
kunal-vaishnavi merged 1 commit intoSep 17, 2026
Merged
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A scalar-beta regression test is needed to protect the memory-safety fix.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Fixes an out-of-bounds shape-inference read caused by validating beta against gamma dimensions.
Changes:
- Validate
betausing its own shape. - Correct the expected
gammarank in the error message.
File summaries
| File | Description |
|---|---|
onnxruntime/core/graph/contrib_ops/shape_inference_functions.cc |
Corrects gamma/beta shape validation. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Author
|
kunal-vaishnavi Can you help review this or help find a suitable reviewer? Thanks. |
kunal-vaishnavi
approved these changes
Sep 16, 2026
Contributor
|
Thanks for your contribution! |
34 of 50 tasks
Contributor
Author
Thanks for the review. Can you help merge this PR if no other issues. |
Tianlei Wu (tianleiwu)
added a commit
that referenced
this pull request
Sep 29, 2026
This cherry-picks the following commits for the release: * #32610 * #32633 * #32641 * #32611 * #32609 * #32607 * #32679 * #32681 * #32666 CI fixes: * #32491 (installs `uuid-dev` for the Linux minimal-build CoreML job; that check also fails on the `rel-1.28.3` base) * Raise the Android minimal baseline binary-size threshold from 1,440,768 to 1,443,840 bytes (release branch only). The checks added by these fixes grow the minimal build from 1,440,538 to 1,443,098 bytes (+2,560). All picks except #32607 applied cleanly with `git cherry-pick -x`, in the order they merged into main (#32666 was added afterward). #32607 required a manual backport because `bert_defs.cc` has diverged on main since 1.28 branched: - `GroupQueryAttention` / `SparseAttention`: backported as-is (`total_sequence_length_index` of 6 / 7, plus the single-element check). The GQA call site in 1.28 has no `sliding_window_cache`, so it only gets the new argument. - `CausalConvWithState`: the 1.28 schema predates `channels_last`, `state_window`, and `dilation`. Only the `ndim` in [1, 3] check and the `weight`/`input` rank == `ndim + 2` checks are backported. These match what the 1.28 CPU kernel already enforces. `ChannelsLastInputRankBelowThreeIsRejected` is dropped. - `GatedDeltaNet`: this op does not exist on 1.28.3, so its hunk and test are dropped. Validation (Windows x64, CPU EP, RelWithDebInfo): - All 14 regression tests added by these PRs pass. - `onnxruntime_test_all`: 1848 tests (including #32666's `PluginCopiesForwardStreams`), 0 failures. - `onnxruntime_provider_test`: 5370 tests, 0 failures. --------- Co-authored-by: Wei Wang <wei4.wang@intel.com> Co-authored-by: shiyi <shiyi.zou@intel.com> Co-authored-by: Bin Miao <bin.miao@intel.com> Co-authored-by: Bryan B <bryan.bernhart@intel.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: tianleiwu <30328909+tianleiwu@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Xiaofei Han <xiaofeihan@microsoft.com>
This was referenced Oct 5, 2026
This was referenced Oct 12, 2026
Open
This was referenced Oct 14, 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
EmbedLayerNormalizationShapeInferencevalidated thebetainput's rank using the wrong shape:beta_dimswas aliased togamma_shape.dim()instead ofbeta_shape.dim(). As a result, a rank-1gammawould let the rank check passeven when
betais a 0-dim scalar, and execution reachedbeta_shape.dim(0).dim_value()— an unchecked protobuf repeated-field access on an emptydimlist, causing an out-of-bounds read during session load, before provider/kernel assignment.Fix
beta_dimstobeta_shape.dim()so the rank check guards the correct input; a scalarbetais now rejected viafail_shape_inferenceinstead of reaching the OOB access. This matches the adjacentgammavalidation.gammaerror message ("2 dimension" → "1 dimension") to reflect the actual check