Repository navigation
[FIX] rcwt_loop: decide teletext mode once from the file header - #2430
VishnuSrivatsava wants to merge 1 commit into
Conversation
The loop re-read parsebuf[6..7] every iteration to choose between the teletext and CEA-608 paths, but in 608 mode parsebuf is reused for data headers and caption blocks, so raw caption bytes 00 02 at offsets 6-7 routed the stream into tlt_read_rcwt() with a NULL teletext context (SEGV in telxcc.c, memcpy to NULL->last_timestamp). Capture the decision in a flag right after the 11-byte file header is validated, and use it inside the loop.
|
The Linux build jobs failing here are pre-existing runner breakage, not caused by this patch. Every "Build CCExtractor on Linux" job dies in the Install dependencies step with The format job failure is also unrelated to this change: its diff touches only Leaving the CI situation to the maintainers. The patch itself is a 7-line change in general_loop.c verified locally on macOS: the PoC from #2429 exits cleanly, teletext-mode RCWT output is unchanged, and a 12-sample corpus shows identical results. If it's useful, I'm happy to help with the #2254 CI side (for example building gpac from source in the workflows) as a separate change. |
In raising this pull request, I confirm the following (please check boxes):
Reason for this PR:
Sanity check:
Fixes #2429
Repro instructions:
Sample (83 bytes): https://gist.github.com/VishnuSrivatsava/79a2d40af506ebabbfe925de9305fb08
(
ghdoes not accept binary gists, so it is base64-encoded:base64 -d crash.rcwt.b64 > crash.rcwt,SHA256
6565e25b9b773ee1ad2731eb3b07ed7266d8f7dfbf2e3601084cc6347ab8c701.)ccextractor crash.rcwton masterd7eb132e: exit 139 (SIGSEGV).SEGV ... WRITE of size 8 ... #0 tlt_read_rcwt telxcc.c:1327 / #1 rcwt_loop general_loop.c:1801.Details and evidence in #2429.
Why it happens
In
rcwt_loop()the teletext-vs-608 choice is made by testingparsebuf[6] == 0 && parsebuf[7] == 2(the file header's format-revision bytes) both before the loop and at the top of every loop
iteration. In 608 mode
parsebufis reused for the 10-byte data header and thenrealloc'd andoverwritten with the raw caption-block bytes, so iteration 2+ inspects caption bytes, not the
header. When the CC byte stream contains
00 02at offsets 6–7, the file is routed totlt_read_rcwt()although the teletext context was never initialized (telxcc_init()only runsin teletext mode) →
memcpy(&(NULL->last_timestamp), ...)→ SIGSEGV.The fix
Decide the mode once from the file header, into
int is_teletext, and test the flag in the loop.+7/−2, one file.
Verification performed
00 03(instead of00 02) does not crash on master,and a genuine teletext-mode RCWT (header revision
00 02) does not crash either —confirming the branch-selection is the specific cause.
a HEVC sample) produce identical output/exit codes on both builds.
clang-format -iproduces no changes; no Rust code touched.Limitations
the format as written by
writercwtdata()/tlt_read_rcwt()semantics. The flag is set from thesame header bytes the old pre-loop check used, so the teletext decision itself is unchanged.