FIX(rust): prevent panic when formatting out-of-range timestamps in timing.rs and c_functions.rs#2138
FIX(rust): prevent panic when formatting out-of-range timestamps in timing.rs and c_functions.rs#2138x15sr71 wants to merge 3 commits intoCCExtractor:masterfrom
Conversation
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 6f7ce27...:
Your PR breaks these cases:
Congratulations: Merging this PR would fix the following tests:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
|
I just tested XMLTV generation with today's x64 and x86 release builds of PR #2138 against a flaky channel full TS. Both failed to complete. The x64 exe said: And the x86 exe said: The full transcript is here: Windows PowerShell 260223.zip |
…t-of-range timestamps
|
@TPeterson94070, Thanks for testing with a new flaky sample and sharing logs, I've pushed a fix for the P.S.: This update addresses the timestamp formatting panics ( |
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 6f7ce27...:
Your PR breaks these cases:
Congratulations: Merging this PR would fix the following tests:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
|
Using today's release x64 and x86 builds, I ran XMLTV tests on two FullTS files that fail on earlier ccextractor builds. The x64 build succeeded on both and the x86 build failed. IIUC, the x86 build failure is expected with this PR. Here is the transcript: And here are links to the two TS files: FullTS_for_ATSC_ch32_(581MHz)-20sec 26-02-23.ts |
|
@TPeterson94070 Yes, that’s correct, x64 is fixed by this PR, and the x86 failure is a separate issue. Thanks for confirming. |
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
Problem
As reported by @TPeterson94070 in #2100, parsing certain ATSC transport streams from a flaky station causes a fatal panic on v0.96.5 x64 builds:
The station intermittently transmits out-of-range PTS values in the video stream. When
to_hms_millis_time(':')attempts to format these values it returnsErr(OutOfRangeError). Because these results were being directly.unwrap()ed insidedebug!andinfo!logging macros intiming.rs, a formatting failure in a log statement was aborting the entire process.Solution
Replaced all direct
.unwrap()calls onto_hms_millis_time()results with.unwrap_or_else(|_| "INVALID".to_string())across two files:lib_ccxr/src/time/timing.rsset_current_pts()— PTS and FTS debug linesset_fts()— first sync time and new min PTS debug linesprint_debug_timing()— sync PTS, GOP time, FTS max, and diff calculation info lineslib_ccxr/src/time/c_functions.rsprint_mstime_static()— timestamp formatting used by C FFI boundaryNo timing logic, sync behavior, or output generation was modified. Only logging and formatting paths are affected.
Testing
Tested locally on macOS ARM64 (Darwin 25.3.0) against
FullTS_for_ATSC_ch32_(581MHz)-20sec.tsprovided by @TPeterson94070.timing.rs:154, process aborts, no XML output generatedOut of Scope for This PR
src/decoder/mod.rs:304withFailed to allocate dtvcc_service_decoder. This is a separate CEA-708 initialization issue unrelated to this timing fix.These items are intentionally kept out of scope for this PR to maintain separation of concerns and can be addressed in follow-up work.