Repository navigation
Conversation
Owner
|
Looks like a reasonable change for an edge case. Do we similarly guard in read or write against negative |
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.
blocks()can yield indefinitely whenblocksize=0(orouthas zero frames) or whenoverlapis at least the effective block size. The number of newly read frames becomes zero, so iteration keeps yielding empty or repeated blocks without consuming the remaining audio. Negative overlap also produces unintended overlapping windows.Validate that the effective block size is positive and
0 <= overlap < blocksizebefore reading. Whenoutis supplied, its length determines the block size. Document these limits and add 16 regressions covering the module function, instance method, and both buffer paths. These tests consume only the first item, so they also fail safely on the previous implementation.Validation on Windows x64, Python 3.12.14, and libsndfile 1.2.2:
ValueError; the 112 valid combinations with overlap, limited frames, fill values, and supplied buffers produce identical data before and after the change.pyright soundfile.py: the same two existing diagnostics at line 188 on both versions (_soundfile_data.__file__can beNone), with no added diagnostics. The type check is not fully passing.This change leaves the short-file/supplied-buffer slicing in #495 unchanged; that PR addresses a separate case with valid parameters.