fix(ffi): reject invalid SoxResampler parameters at creation - #1471
Closed
RaphaelFakhri wants to merge 2 commits into
Closed
RaphaelFakhri wants to merge 2 commits into
RaphaelFakhri wants to merge 2 commits into
Conversation
Author
|
Valid finding, fixed in the new commit. The |
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.
Summary
SoxResampleraccepted parameters that soxr cannot resample with and returned a resampler that failed later. This change validates them at creation and returns an error instead.pushthen panicked (verified for a zero input rate).pushpanicked on an integer division by zero.soxr_createwas called with a null error pointer, so a creation failure was never reported and only produced a nullsoxr_t.Because these run behind the FFI boundary, a bad value passed from an SDK such as
AudioResampler(input_rate=0, ...)aborts the host process instead of raising an error.Changes
SoxResamplerInner::new.soxr_createand return its message. A null result without a message returns a generic error.invalid_parameters_are_rejectedto the resampler tests.livekit-ffipatch changeset.Testing
cargo test -p livekit-ffi --lib resamplerinvalid_parameters_are_rejectedfails and the other resampler tests pass (7 passed, 1 failed).cargo fmt -p livekit-ffi -- --checkreports no changes.