Raise TimestampParseError on an out-of-range timestamp - #100
Open
eeshsaxena wants to merge 3 commits into
Open
Conversation
This is no longer supported or operational.
The timestamp regex matches unbounded digit runs, so a value like "9999999999999999999:00:00,000" parses but overflows timedelta's C-level day count, and srt_timestamp_to_timedelta leaked a raw OverflowError. parse() then propagated it too, despite both being documented to raise TimestampParseError / SRTParseError. Catch the overflow and raise TimestampParseError instead.
Author
|
Hi! Gentle nudge on this one whenever you have some bandwidth. It's a small, self-contained fix ( |
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.
srt_timestamp_to_timedeltaleaksOverflowErroron a syntactically valid but absurdly large timestamp:RGX_TIMESTAMP_FIELDis[0-9]+(an unbounded digit run), so the value matches the regex, but the resultingintoverflowstimedelta's C-level day count. The hours, seconds and milliseconds fields are all affected, andparse()propagates it, even though both functions documentTimestampParseError/SRTParseErroras the failure mode.The fix wraps the
timedeltaconstruction and re-raises asTimestampParseError, matching the existing 'unparseable timestamp' path. Added a parametrized test covering the hours, seconds and milliseconds fields.