Skip to content

Ignore excess data in DFT.#29680

Open
skottmckay wants to merge 3 commits into
mainfrom
skottmckay/MSRC_124846
Open

Ignore excess data in DFT.#29680
skottmckay wants to merge 3 commits into
mainfrom
skottmckay/MSRC_124846

Conversation

@skottmckay

Copy link
Copy Markdown
Contributor

Description

Fix invalid read. Ignoring is consistent with other paths so not treating it as an error.

Motivation and Context

MSRC 124846

Ignoring is consistent with other paths so not treating it as an error.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_length and checks the expected output.
  • Add a small guard in the IRFFT conjugate-symmetry loop to avoid size_t underflow 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).

skottmckay and others added 2 commits July 14, 2026 11:00
### 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>
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.

3 participants