Skip to content

FIX: reject non-finite AudioSpeed speed factors - #2560

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

FIX: reject non-finite AudioSpeed speed factors#2560
Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 2 commits into
microsoft:mainfrom
sylvesterkaczmarek:fix/audio-speed-finite-factor

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Description

AudioSpeedConverter validates that speed_factor is greater than zero and at most 100, but floating-point NaN passes both comparisons.

A speed_factor=float("nan") therefore constructs successfully and fails later during resampling when the converter tries to calculate an integer output length. Infinite values should also be rejected explicitly as invalid configuration.

This change requires speed_factor to be finite in addition to the existing range constraints, so invalid values fail immediately with a clear ValueError.

Tests

Adds regression coverage for NaN, positive infinity, and negative infinity while preserving the existing zero and negative-value checks.

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