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 5 commits intoCCExtractor:masterfrom
Conversation
|
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 ( |
|
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. |
|
@TPeterson94070 I’ve pushed a separate commit in my fork with the allocation fix, and CI has produced a new x86 (32-bit) build. I don’t have access to a Windows 32-bit setup on my side, so I’m not able to test the x86 binary directly. Could you please try this artifact with the same flaky TS file that previously failed? Artifact: |
|
@x15sr71, sorry, today's build also failed those files. Here's the transcript: BTW, you can run the 32-bit exe on a Windows 64-bit OS (which is what I just did). |
TIMING_PATCH_ACTIVE was a temporary diagnostic string added to verify that GitHub Actions was building fresh artifacts from the correct branch commit, and not serving a stale cached binary. Build freshness was confirmed. Reverted back to INVALID.
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 733ed89...:
Congratulations: Merging this PR would fix the following tests:
All tests passed completely. Check the result page for more info. |
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 733ed89...:
Congratulations: Merging this PR would fix the following tests:
All tests passed completely. Check the result page for more info. |
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.