Skip to content

[FIX] Skip malformed SCC hex words without aborting - #2451

Open
harshalsp07 wants to merge 1 commit into
CCExtractor:masterfrom
harshalsp07:fix/scc-unicode-tokens
Open

harshalsp07 wants to merge 1 commit into
CCExtractor:masterfrom
harshalsp07:fix/scc-unicode-tokens

Conversation

@harshalsp07

@harshalsp07 harshalsp07 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

In raising this pull request, I confirm the following (please check boxes):

Reason for this PR:

  • This PR adds new functionality.
  • This PR fixes a bug that I have personally experienced or that a real user has reported and for which a sample exists.
  • This PR is porting code from C to Rust.

Sanity check:

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • If the PR adds new functionality, I've added it to the changelog. If it's just a bug fix, I have NOT added it to the changelog.
  • I am NOT adding new C code unless it's to fix an existing, reproducible bug.

An SCC word such as a€ passes the four-byte length check, then panics when parse_hex_pair() slices inside the UTF-8 character. At the C/Rust boundary this aborts CCExtractor with SIGABRT.

Check that all four bytes are ASCII hex digits before slicing. Invalid words are skipped, matching the parser's existing handling of malformed hex, and the valid caption data around them is kept. This also rejects signed words such as +120 that from_str_radix() would otherwise accept.

Reproduce from the repository root with the included 95-byte sample:

ccextractor tests/samples/scc_unicode_token.scc -o out.srt

On master d7eb132e, this aborts with end byte index 2 is not a char boundary. With this change it exits 0 and writes the HI caption.

Tested on Linux:

  • cargo test --locked in src/rust: 428 passed. Both new regression tests fail without the fix.
  • cargo fmt --all -- --check and cargo clippy -- -D warnings pass.
  • Release CMake build and 189 CLI runs covering malformed tokens, BOM/CRLF, automatic and explicit SCC input, frame-rate options and five output formats. All 72 comparisons for valid input are byte-identical to master.

Windows/macOS and the external sample platform haven't been tested.

CI note: The initial Linux build stops before compilation because libgpac-dev has no installation candidate on Ubuntu 26.04; #2428 addresses the runner change. The C format check also flags ccx_decoders_isdb.c and mp4.c, which are unchanged from master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant