Repository navigation
Conversation
With --out=report no encoder is created, so C passes a NULL enc_ctx to ccxr_read_gop_info(), ccxr_read_pic_info() and ccxr_read_eau_info(). The wrappers turned it into a &mut reference, which is undefined behaviour. Debug builds abort with "null reference produced" on any MPEG-2 video; release builds happen to work because the pointer is only handed back to C (store_hdcc, process_hdcc), which accepts NULL. Keep enc_ctx as a raw pointer through the ES parser instead. Unlike the AVC path, which skips parsing without an encoder, this keeps the report's caption detection working.
CCExtractor CI platform finished running the test files on windows. 171/238 tests matched the approved output:
67 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.
Compared with the tip of master — test 10181, commit 2c1c1c6:
Compared with the commit this branch was cut from: the same run as the tip of master (test 10181), so the comparison above already covers it. No test changes behaviour relative to the tip of master: every failure above fails there too, byte for byte. The approved output for those tests is out of date, which is a baseline to review rather than a regression in this branch. |
CCExtractor CI platform finished running the test files on linux. 171/238 tests matched the approved output:
67 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.
Compared with the tip of master — test 10178, commit f56427e:
Compared with the commit this branch was cut from: the same run as the tip of master (test 10178), so the comparison above already covers it. No test changes behaviour relative to the tip of master: every failure above fails there too, byte for byte. The approved output for those tests is out of date, which is a baseline to review rather than a regression in this branch. |
In raising this pull request, I confirm the following (please check boxes):
Reason for this PR:
Sanity check:
Repro instructions (debug build,
./build -debug):On master it aborts:
Any MPEG-2 video with a GOP header does this. With ASan, 26 of the 28 MPEG-2 samples in our local set abort in report mode.
Problem
--out=reportcreates no encoder, so C passesenc_ctx = NULLtoccxr_read_gop_info(),ccxr_read_pic_info()andccxr_read_eau_info(). The wrappers turn it into&mut *enc_ctx, which is undefined behaviour. Debug builds catch it and abort. Release builds happen to work, because the ES parser never reads through the pointer. It only hands it back to C (store_hdcc(),process_hdcc()), which accepts NULL.Fix
Keep
enc_ctxas*mut encoder_ctxthrough the ES parser (gop, pic, eau, userdata).read_eau_info()andextension_and_user_data()becomeunsafe fnlike their siblings, since they now forward a raw pointer.The AVC path took another route for the same NULL (fecd24d): it skips parsing when there is no encoder. That route isn't taken here, because it loses caption detection: the report would say
EIA-608: Nofor every MPEG-2 file.Verification
es::tests::test_null_enc_ctx_is_acceptedcalls the three wrappers with a NULLenc_ctx. On master it fails with the same "null reference produced" panic; with the fix it passes. The fullcargo testpasses (449 tests), as doescargo clippy -- -D warnings.EIA-608: Yes/CEA-708: Yes. That's byte-identical to the master release build's report..ts,.mpg,.vob,.wtv,.dvr-ms): the SRT output is byte-identical to master on all 45, and--out=reportcompletes on all of them.Not fixed here
--videoeditedwith two or more TS inputs crashes on master, with or without--out=report.general_loop()freesdec_ctx->xds_ctxat the end of each file without clearing it (a double free), and the second file then hits a NULLmemmoveincopy_payload_to_capbuf(). That's a separate PR.