mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-04-21 05:29:50 +00:00
[PR #1812] fix(rust): prevent panics in timing code when processing multiple files #2555
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/1812
State: closed
Merged: Yes
Summary
thread caused non-unwinding panic. aborting.) when processing multiple files with different characteristics (e.g., DVD-type followed by HDTV-type media).unwrap()and.expect()calls with safe alternatives throughout the Rust timing codeGopTimeCode::new()to handle edge casesRoot Cause
The crash occurred because Rust code was using
.unwrap()on type conversions and.expect()on Result values inextern "C"functions. When processing files with different characteristics sequentially, stale timing state from previous files could cause these conversions to fail, triggering panics. Since Rust panics cannot unwind across FFI boundaries, this resulted in immediate process termination.Changes
src/rust/src/libccxr_exports/time.rs:unwrap_or(0)for alltry_into()conversionsapply_timing_info()andwrite_back_from_timing_info()ccxr_calculate_ms_gop_time()to use safe fallback calculationsrc/rust/lib_ccxr/src/time/units.rs:from_hms_millisfailures.expect()with.ok()?Test plan
Fixes #1377
🤖 Generated with Claude Code