Open
Conversation
The LACE and NoLACE feature networks access the pitch embedding table using periods[i_subframe] as a direct index without bounds checking. SILK's decode_pitch() clamps pitch lags to [min_lag, max_lag] where max_lag = PE_MAX_LAG_MS * Fs_kHz = 288 at 16kHz. If a model is trained with pitch_max < 288 (the Python training defaults use pitch_max=257), pitch lag values in the range [pitch_max+1, 288] would read past the end of the embedding weight table. Add IMIN/IMAX clamping to bound the pitch index to [0, *_PITCH_MAX] before the embedding lookup, consistent with how FARGAN handles pitch embedding access in fargan.c:53. The current shipped model (v1.6.1) uses pitch_max=300 which covers the full SILK pitch range, but the C code should defensively clamp regardless of model parameters.
031c1e0 to
7269861
Compare
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.
Missing bounds clamp on SILK pitch lag before OSCE embedding table lookup causes up to 7936-byte heap OOB read when the model is trained with Python default pitch_max=257 (max lag is 288); fix adds IMIN/IMAX clamping matching FARGAN's existing pattern.