mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-07-08 18:06:30 +00:00
[PR #1855] fix(raw): Fix premature EOF and timing overflow in raw_loop #2622
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/CCExtractor/ccextractor/pull/1855
State: closed
Merged: Yes
Summary
Fixes #1565 - CCExtractor stops processing raw caption files at exactly 9:43:00 (2MB).
Root causes found and fixed:
Premature EOF bug: After processing the first chunk (BUFSIZE = ~2MB),
data->lenwas never reset to 0. On the next iteration,general_get_more_data()calculatedwant = BUFSIZE - data->len = 0and returned EOF immediately.data->len = 0after processing each chunk and changed loop condition fromwhile (data->len)towhile (1)with explicit breaks.32-bit integer overflow: The calculation
cb_field1 * 1001 / 30 * (MPEG_CLOCK_FREQ / 1000)overflowed whencb_field1was large (>1 million). For example,34,989,487 * 90 = 3,149,053,830exceeds the 32-bit signed integer max (2,147,483,647).cb_field1toLLONGbefore the multiplication.Timing initialization: Raw mode needs proper initialization (
min_pts=0,sync_pts=0,pts_set=MinPtsSet) for the Rust timing code to calculatefts_nowcorrectly.Test plan
Tested with sample files from issue #1565:
🤖 Generated with Claude Code