mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-02-03 21:23:48 +00:00
[PR #1838] [MERGED] fix(teletext): Prevent double-free crash in teletext cleanup #2597
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/CCExtractor/ccextractor/pull/1838
Author: @cfsmp3
Created: 12/17/2025
Status: ✅ Merged
Merged: 12/17/2025
Merged by: @cfsmp3
Base:
master← Head:fix/teletext-double-free-crash📝 Commits (1)
9cf96b1fix(teletext): Prevent double-free crash in teletext cleanup📊 Changes
1 file changed (+14 additions, -0 deletions)
View changed files
📝
src/lib_ccx/general_loop.c(+14 -0)📄 Description
Summary
This PR fixes a critical double-free bug that caused CCExtractor to crash with exit code 134 (SIGABRT) when processing teletext streams. The crash occurred during cleanup after processing completed.
Problem
The teletext context (
TeletextCtx) pointer was shared between two structures:dec_ctx->private_data(decoder context)cinfo->codec_private_data(capture info incinfo_tree)Crash sequence:
general_loop()callstelxcc_close(&dec_ctx->private_data)→ frees TeletextCtx, NULLsdec_ctx->private_datacinfo->codec_private_datastill points to the freed memory (not NULLed!)dinit_cap()sees non-NULLcinfo->codec_private_datadinit_cap()callstelxcc_close()again → double-free crashRoot Cause
This bug was exposed by commit
7e1a01447("fix(ocr): Improve DVB subtitle OCR quality") which added cleanup code todinit_cap()to freecodec_private_data. Thetelxcc_close()call ingeneral_loop()has existed since 2015, but the double-free only became possible after the new cleanup code was added.Solution
After
telxcc_close()frees the teletext context ingeneral_loop(), iterate through allcinfoentries and NULL out any that shared the same pointer:Test Plan
Tests Validated (27 total)
All tests that were failing with exit code 134 now pass:
Teletext Section (21 tests):
--datapid 2310 --autoprogram --out=srt --latin1--autoprogram --out=srt --latin1--autoprogram --out=ttxt --latin1--autoprogram --out=ttxt --latin1--autoprogram --out=ttxt --latin1--autoprogram --out=ttxt --latin1--autoprogram --out=ttxt --latin1--autoprogram --out=ttxt --latin1--autoprogram --out=ttxt --latin1--autoprogram --out=ttxt --latin1--autoprogram --out=ttxt --latin1--autoprogram --out=ttxt --latin1--autoprogram --out=ttxt --latin1--autoprogram --out=ttxt --latin1--autoprogram --out=ttxt --latin1--autoprogram --out=ttxt --latin1 --datets--autoprogram --out=srt --latin1 --tpage 398--autoprogram --out=srt --latin1 --tpage 299--autoprogram --out=srt --latin1 --tpage 299--autoprogram --out=srt --latin1 --teletext --tpage 398--autoprogram --out=ttxt --latin1DVB Section (2 tests):
--autoprogram --out=srt --latin1--datapid 5603 --autoprogram --out=srt --latin1 --teletextOther Teletext Tests (4 tests):
--xmltv=3 --out=null--tpage 801--tverbose--teletextValgrind Verification
Confirmed no double-free or invalid free errors with valgrind:
CI Reference
Failing CI run: https://sampleplatform.ccextractor.org/test/6880
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.