[BUG]: Segmentation fault in report-only(-out=report) mode when processing AVC/H.264 streams with Rust decoder #902

Closed
opened 2026-01-29 16:56:32 +00:00 by claunia · 0 comments
Owner

Originally created by @x15sr71 on GitHub (Jan 16, 2026).

Summary

CCExtractor crashes with a segmentation fault when running in report-only mode (-out=report) on files containing AVC/H.264 video streams when the Rust AVC decoder is enabled (default in recent builds).

Command used

./ccextractor -out=report input.ts

Where input.ts is any transport stream file containing H.264 video.

Segmentation fault

Opening file: 7236304cfcfce141c7cec31647c1268a3886063390ce43c2f71188c70f5494c4.ts
Analyzing data in general modetream
[1]    97365 segmentation fault  ccextractor  -out=null

Expected behavior

CCExtractor should generate a report without crashing, as report generation does not require video decoding.

Actual behavior

Segmentation fault (SIGSEGV) at address 0x50 when attempting to dereference encoder_ctx->timing inside the Rust AVC decoder.

Root cause

The crash occurs because:

  1. Report-only mode (-out=report) does not initialize video decoding structures, specifically:

    • encoder_ctx->timing remains NULL
    • lib_cc_decode->avc_ctx may remain NULL
  2. The Rust AVC decoder (ccxr_process_avc) assumes these structures are always initialized and dereferences them unconditionally

  3. The C→Rust boundary in process_avc() does not validate these preconditions before calling into Rust

Technical details

Crash location(lldb):

Thread 1: EXC_BAD_ACCESS (code=1, address=0x50)
Frame: ccx_rust::avc::core::process_avc
Instruction: ldr x0, [x8, #0x50]  ; loading enc_ctx.timing

Call stack:

process_avc (avc_functions.c)
  └─ ccxr_process_avc (Rust FFI)
       └─ ccx_rust::avc::core::process_avc
            └─ ccxr_set_fts(enc_ctx.timing)  ← NULL dereference

Proposed Solution

Add a guard at the C-Rust boundary in process_avc() that skips AVC processing when the decoder isn't fully initialized (like in report-only mode).

Originally created by @x15sr71 on GitHub (Jan 16, 2026). ### Summary CCExtractor crashes with a segmentation fault when running in report-only mode (`-out=report`) on files containing `AVC/H.264` video streams when the Rust AVC decoder is enabled (default in recent builds). ### Command used ``` ./ccextractor -out=report input.ts ``` Where `input.ts` is any transport stream file containing [H.264 video](https://sampleplatform.ccextractor.org/sample/7236304cfcfce141c7cec31647c1268a3886063390ce43c2f71188c70f5494c4). ### Segmentation fault ``` Opening file: 7236304cfcfce141c7cec31647c1268a3886063390ce43c2f71188c70f5494c4.ts Analyzing data in general modetream [1] 97365 segmentation fault ccextractor -out=null ``` ### Expected behavior CCExtractor should generate a report without crashing, as report generation does not require video decoding. ### Actual behavior Segmentation fault (SIGSEGV) at address `0x50` when attempting to dereference `encoder_ctx->timing` inside the Rust AVC decoder. ### Root cause The crash occurs because: 1. **Report-only mode** (`-out=report`) does not initialize video decoding structures, specifically: - `encoder_ctx->timing` remains `NULL` - `lib_cc_decode->avc_ctx` may remain `NULL` 2. **The Rust AVC decoder** (`ccxr_process_avc`) assumes these structures are always initialized and dereferences them unconditionally 3. **The C→Rust boundary** in `process_avc()` does not validate these preconditions before calling into Rust ### Technical details **Crash location(lldb):** ``` Thread 1: EXC_BAD_ACCESS (code=1, address=0x50) Frame: ccx_rust::avc::core::process_avc Instruction: ldr x0, [x8, #0x50] ; loading enc_ctx.timing ``` **Call stack:** ``` process_avc (avc_functions.c) └─ ccxr_process_avc (Rust FFI) └─ ccx_rust::avc::core::process_avc └─ ccxr_set_fts(enc_ctx.timing) ← NULL dereference ``` ## Proposed Solution Add a guard at the C-Rust boundary in `process_avc()` that skips AVC processing when the decoder isn't fully initialized (like in report-only mode).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#902