Skip to content

FIX: reject non-finite AudioEcho parameters - #2566

Open
Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 2 commits into
microsoft:mainfrom
sylvesterkaczmarek:fix/audio-echo-finite-params
Open

FIX: reject non-finite AudioEcho parameters#2566
Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 2 commits into
microsoft:mainfrom
sylvesterkaczmarek:fix/audio-echo-finite-params

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Description

AudioEchoConverter validates the numeric ranges of delay and decay, but IEEE-754 NaN passes ordinary range comparisons. delay=float("nan") therefore constructs successfully and fails later when the converter calculates the integer delay in samples, while non-finite decay values can propagate invalid audio data.

This change requires both parameters to be finite in addition to their existing range constraints:

  • delay must be finite and greater than zero.
  • decay must be finite and strictly between zero and one.

Invalid configuration now fails immediately with a clear ValueError.

Tests

Adds regression coverage for NaN, positive infinity and negative infinity for both delay and decay, while preserving the existing zero, negative and out-of-range validation.

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.

1 participant