Ignore excess data in DFT.#29680
Open
skottmckay wants to merge 3 commits into
Open
Conversation
Ignoring is consistent with other paths so not treating it as an error.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a memory-safety issue in the CPU DFT operator’s Bluestein (non power-of-2) path by ensuring that when dft_length is smaller than the provided input length, trailing samples are ignored instead of being read/used in computations (which previously could lead to out-of-bounds indexing). It also adds a regression test to validate the truncation behavior.
Changes:
- Clamp the effective sample count in the Bluestein DFT implementation to
min(input_length, dft_length)to avoid invalid reads when the input is longer than the transform length. - Add an opset-20 unit test that exercises the Bluestein path with
dft_length < input_lengthand checks the expected output. - Add a small guard in the IRFFT conjugate-symmetry loop to avoid
size_tunderflow when the effective sample count is 0.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| onnxruntime/core/providers/cpu/signal/dft.cc | Prevents out-of-bounds access by truncating the effective input length to dft_length in the Bluestein path (and guards a conjugate loop edge case). |
| onnxruntime/test/providers/cpu/signal/signal_ops_test.cc | Adds a regression test covering dft_length truncation behavior in the Bluestein path (opset 20). |
### Description
Windows GPU DML CI failed on
`SignalOpsTest.DFT20_Float_Bluestein_DftLengthTruncatesInput` in
`onnxruntime_provider_test`. This PR excludes that single deprecated
DirectML path while keeping CPU coverage and expected-output validation
intact.
- **Targeted test routing change**
- Updated `SignalOpsTest.DFT20_Float_Bluestein_DftLengthTruncatesInput`
to run with provider config and exclude `kDmlExecutionProvider`.
- Scope is intentionally limited to the failing test case.
- **Behavior preserved for non-DML EPs**
- Test inputs/expected outputs and tolerances are unchanged.
- Only EP selection for this test was adjusted.
```cpp
test.SetOutputAbsErr("output", 0.001f);
test.ConfigExcludeEps({kDmlExecutionProvider});
test.RunWithConfig();
```
### Motivation and Context
The failing CI signal came from a deprecated DML execution path for this
Bluestein/truncation scenario, causing an otherwise healthy provider
test shard to fail. Excluding DML for this one case removes the
known-bad path without changing operator behavior or broader test
intent.
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
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
Fix invalid read. Ignoring is consistent with other paths so not treating it as an error.
Motivation and Context
MSRC 124846