[BUG] Segmentation fault when extracting from MP4 which remuxed from HLS #806

Closed
opened 2026-01-29 16:53:49 +00:00 by claunia · 3 comments
Owner

Originally created by @szescxz on GitHub (Jun 9, 2024).

CCExtractor version: 0.94

In raising this issue, I confirm the following:

  • I have read and understood the contributors guide.
  • I have checked that the bug-fix I am reporting can be replicated, or that the feature I am suggesting isn't already present.
  • I have checked that the issue I'm posting isn't already reported.
  • I have checked that the issue I'm porting isn't already solved and no duplicates exist in closed issues and in opened issues
  • I have checked the pull requests tab for existing solutions/implementations to my issue/suggestion.
  • I have used the latest available version of CCExtractor to verify this issue exists.
  • I have ticked all the boxes in this section and to prove it I'm deleting the section completely to remove boilerplate text.

Necessary information

  • Is this a regression (i.e. did it work before)?
    Yes, works with 0.87
  • What platform did you use?
    Tested on both Windows and Linux
  • What were the used arguments?
    -out=srt

Video links

https://github.com/CCExtractor/ccextractor/assets/49463229/fe90d91d-6a1e-4cf3-8143-6083e4ccdf7a

Original HLS source (requires US IP): https://tve-vod-preview.cdn.turner.com/toon/c26e41c4570090fca8e550ecca41df0b/layer1/layer1.m3u8

Additional information

With version 0.94, CCExtractor only extracts when I remux the HLS stream to MPEGTS with ffmpeg -i <hls link> -c copy test.ts. If I remux it to MP4 (ffmpeg -i test.ts -c copy test.mp4), CCExtractor throws a Segmentation fault.

Originally created by @szescxz on GitHub (Jun 9, 2024). CCExtractor version: 0.94 # In raising this issue, I confirm the following: - [x] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [x] I have checked that the bug-fix I am reporting can be replicated, or that the feature I am suggesting isn't already present. - [x] I have checked that the issue I'm posting isn't already reported. - [x] I have checked that the issue I'm porting isn't already solved and no duplicates exist in [closed issues](https://github.com/CCExtractor/ccextractor/issues?q=is%3Aissue+is%3Aclosed) and in [opened issues](https://github.com/CCExtractor/ccextractor/issues) - [x] I have checked the pull requests tab for existing solutions/implementations to my issue/suggestion. - [x] I have used the latest available version of CCExtractor to verify this issue exists. - [x] I have ticked all the boxes in this section and to prove it I'm deleting the section completely to remove boilerplate text. # Necessary information - Is this a regression (i.e. did it work before)? Yes, works with 0.87 - What platform did you use? Tested on both Windows and Linux - What were the used arguments? `-out=srt` # Video links https://github.com/CCExtractor/ccextractor/assets/49463229/fe90d91d-6a1e-4cf3-8143-6083e4ccdf7a Original HLS source (requires US IP): https://tve-vod-preview.cdn.turner.com/toon/c26e41c4570090fca8e550ecca41df0b/layer1/layer1.m3u8 # Additional information With version 0.94, CCExtractor only extracts when I remux the HLS stream to MPEGTS with `ffmpeg -i <hls link> -c copy test.ts`. If I remux it to MP4 (`ffmpeg -i test.ts -c copy test.mp4`), CCExtractor throws a `Segmentation fault`.
Author
Owner

@x15sr71 commented on GitHub (Oct 24, 2025):

Hi @szescxz,

Thanks for reporting this issue. I’ve tested your scenario with CCExtractor 0.94 on a remuxed MP4 from HLS. In the current build, I’m not able to reproduce the segmentation fault — both TS and MP4 inputs are processed safely, and the program exits gracefully if no captions are found.

It looks like the MP4 parser has been improved, so the crash you observed no longer occurs.

Could you please confirm if you are still seeing this issue?

@x15sr71 commented on GitHub (Oct 24, 2025): Hi @szescxz, Thanks for reporting this issue. I’ve tested your scenario with CCExtractor 0.94 on a remuxed MP4 from HLS. In the current build, I’m not able to reproduce the segmentation fault — both TS and MP4 inputs are processed safely, and the program exits gracefully if no captions are found. It looks like the MP4 parser has been improved, so the crash you observed no longer occurs. Could you please confirm if you are still seeing this issue?
Author
Owner

@szescxz commented on GitHub (Oct 24, 2025):

Could you please confirm if you are still seeing this issue?

@x15sr71 Yes, with the sample MP4 file I have provided in the original post.

Fresh attempt under Windows 11:

  1. Download the portable version of CCExtractor 0.94 (ZIP SHA-512: 59cffdba1acceca982917ece49690cd226a7e132acf1dbb70afaf74703387d17ad18f14157feb3c2bbe44e9adc1d43328f66d8f4265cc1e71c2047b653222a7e)
  2. Download the sample MP4 (SHA-512: ed3e27e04fa310011246ad2ced834e2ff143bce6099df893baf48adfa17ddc00bd6a121d04d612fd17b0cdcc747378eba6e9829bb6344cc367612bcdf7a10771)
  3. ccextractorwinfull.exe -out=srt path_to.mp4

Truncated output:

XDS: ContentAdvisory: US TV Parental Guidelines. Age Rating: TV-Y (All Children)
XDS:
  thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', src\decoder\service_decoder.rs:275:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@szescxz commented on GitHub (Oct 24, 2025): > Could you please confirm if you are still seeing this issue? @x15sr71 Yes, **with _the_ sample MP4 file I have provided in the original post**. Fresh attempt under Windows 11: 1. Download [the portable version of CCExtractor 0.94](https://github.com/CCExtractor/ccextractor/releases/download/v0.94/CCExtractor_win_portable.zip) (ZIP SHA-512: `59cffdba1acceca982917ece49690cd226a7e132acf1dbb70afaf74703387d17ad18f14157feb3c2bbe44e9adc1d43328f66d8f4265cc1e71c2047b653222a7e`) 2. Download [the sample MP4](https://github.com/CCExtractor/ccextractor/assets/49463229/fe90d91d-6a1e-4cf3-8143-6083e4ccdf7a) (SHA-512: `ed3e27e04fa310011246ad2ced834e2ff143bce6099df893baf48adfa17ddc00bd6a121d04d612fd17b0cdcc747378eba6e9829bb6344cc367612bcdf7a10771`) 3. `ccextractorwinfull.exe -out=srt path_to.mp4` Truncated output: ``` XDS: ContentAdvisory: US TV Parental Guidelines. Age Rating: TV-Y (All Children) XDS: thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', src\decoder\service_decoder.rs:275:25 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ```
Author
Owner

@x15sr71 commented on GitHub (Oct 26, 2025):

Hi @szescxz,

Good news! I've investigated this issue and confirmed that the bug has already been fixed in the current master branch.

The Problem

The v0.94 crash occurred because, after the port of the C-based 708 decoder to Rust (introduced after version 0.87), the code accessed block[0] and block[1] in /src/rust/src/decoder/service_decoder.rs without validating that the block had sufficient data, causing a panic when processing your remuxed MP4 file with truncated CEA-708 caption data.

The Fix

The current master includes comprehensive bounds validation:

  • Empty block check before accessing block[0]
  • Length validation in handle_C3 before processing C3 commands

I've verified with your sample file that the current master processes it without crashing.

What This Means

Since the fix is already in master, it should be included in the next release. In the meantime you can build from master.

This fix was implemented sometime after the v0.94 release (likely in 2024 based on commit history).
Thank you for the detailed bug report with reproduction steps!


@cfsmp3 @canihavesomecoffee @pszemus – just wanted to bring this to your attention. Could you please advise if this issue should be closed now or kept open until the next release is tagged?

@x15sr71 commented on GitHub (Oct 26, 2025): Hi @szescxz, Good news! I've investigated this issue and confirmed that **the bug has already been fixed** in the current master branch. ### The Problem The v0.94 crash occurred because, after the port of the C-based 708 decoder to Rust (introduced after version 0.87), the code accessed `block[0]` and `block[1] `in `/src/rust/src/decoder/service_decoder.rs` without validating that the block had sufficient data, causing a panic when processing your remuxed MP4 file with truncated CEA-708 caption data. ### The Fix The current master includes comprehensive bounds validation: - Empty block check before accessing `block[0]` - Length validation in `handle_C3` before processing C3 commands I've verified with your [sample file](https://github.com/CCExtractor/ccextractor/assets/49463229/fe90d91d-6a1e-4cf3-8143-6083e4ccdf7a) that the current master processes it without crashing. ### What This Means Since the fix is already in master, it should be included in the next release. In the meantime you can build from master. This fix was implemented sometime after the v0.94 release (likely in 2024 based on commit history). Thank you for the detailed bug report with reproduction steps! --- @cfsmp3 @canihavesomecoffee @pszemus – just wanted to bring this to your attention. Could you please advise if this issue should be closed now or kept open until the next release is tagged?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#806