Repository navigation
Bound selected frame duration before multiplication - #513
Closed
nailongzhanshen666 wants to merge 1 commit into
Closed
nailongzhanshen666 wants to merge 1 commit into
nailongzhanshen666 wants to merge 1 commit into
Conversation
Member
|
Thanks for reviving the issue. I chose to land #494 instead (similar change, but test didn't break shared library build) |
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
Closes #491.
Reject a selected frame longer than 120 ms before the duration checks multiply
new_size. The limit is computed as3*(Fs/25), keeping the arithmetic within range for the supported sample rates without introducing 64-bit multiplications. Apply the limit after the expert-duration selection, so selecting a short frame from a longer input remains valid.Add a direct
frame_size_select()regression intest_opus_encode, before the existing encoder regressions. It covers the reported value, the nine legal durations at six sample rates, the upper boundary,INT_MAX, and forced-duration selection. Calling the selection helper directly avoids allocating an enormous PCM buffer or provoking the downstream stack allocation just to test argument validation.Verification
GCC 13.3.0, CMake 3.28.3, Linux x86-64, Release builds with:
bafd40dcbd506e12da257b8cb05c0afe1ed44719implementation, the new regression exits withruntime error: signed integer overflow: 1073741864 * 400 cannot be represented in type 'int'.test_opus_apiandtest_opus_encodepass in both the default floating-point build andOPUS_FIXED_POINT=ON(2/2 CTest targets in each build).SEED=1 TEST_OPUS_NOFUZZ=1; the existing regressions and encoding tests run, while the optional garbage-decoder/online-setting fuzzing is skipped.git diff --checkpasses; the tested builds emitted no compiler warnings.This is not a claim of full ASan/UBSan, all-target CTest, hardware, or fuzz-campaign coverage. The observed local failure is the signed overflow in validation, not a reproduction of the report's downstream stack crash.
Credits and earlier attempts
Thanks to @Amelia-Wang-Hanyu/FuzzAnything for the public report. @afonsojanu previously proposed fixes in #494 and #500; both were closed by their author during general PR cleanup on 2026-10-05. This is a follow-up proposal with a selected-duration bound and direct selection regression, not a new vulnerability discovery. No open replacement PR was found when submitting this change.
AI assistance was used for the code, tests, local validation, and this description.