mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-07-08 18:06:30 +00:00
[PR #1828] [MERGED] fix: Comprehensive bug fixes - Phases 2-4 (Memory, Buffer, Rust FFI) #2580
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/1828
Author: @cfsmp3
Created: 12/15/2025
Status: ✅ Merged
Merged: 12/15/2025
Merged by: @cfsmp3
Base:
master← Head:fix/memory-issues-batch-2.1📝 Commits (10+)
95f6f09fix(memory): Fix memory leaks in ocr.c and ts_tables_epg.c390c96ffix(memory): Fix memory leaks and unsafe realloc patterns in multiple files3b0a63dfix(memory): Fix memory leaks and unsafe realloc patterns in lib_ccx, utility, avc_functionsea4f884fix(memory): Fix unsafe realloc patterns in asf_functions, telxcc, and ccx_encoders_srt5b286c5fix(memory): Fix potential memory leaks in encoder files494b14bfix(memory): Fix memory issues in helpers, splitbysentence, and output90519e2fix(memory): Fix memory issues in final batch of files (Batch 2.7)af3ab5afix(buffer): Replace unsafe string functions with safe alternativesd8048bcfix(rust): Complete Phase 4 - FFI safety and documentationd202a66style(rust): Apply cargo fmt formatting📊 Changes
43 files changed (+608 additions, -275 deletions)
View changed files
📝
src/lib_ccx/asf_functions.c(+12 -4)📝
src/lib_ccx/avc_functions.c(+12 -4)📝
src/lib_ccx/ccx_decoders_608.c(+6 -4)📝
src/lib_ccx/ccx_encoders_helpers.c(+9 -1)📝
src/lib_ccx/ccx_encoders_smptett.c(+7 -3)📝
src/lib_ccx/ccx_encoders_splitbysentence.c(+22 -5)📝
src/lib_ccx/ccx_encoders_spupng.c(+33 -14)📝
src/lib_ccx/ccx_encoders_srt.c(+7 -2)📝
src/lib_ccx/ccx_encoders_ssa.c(+7 -2)📝
src/lib_ccx/ccx_encoders_webvtt.c(+12 -4)📝
src/lib_ccx/ccx_gxf.c(+3 -2)📝
src/lib_ccx/dvb_subtitle_decoder.c(+3 -0)📝
src/lib_ccx/dvd_subtitle_decoder.c(+30 -1)📝
src/lib_ccx/ffmpeg_intgr.c(+29 -6)📝
src/lib_ccx/general_loop.c(+7 -2)📝
src/lib_ccx/hardsubx.c(+19 -0)📝
src/lib_ccx/lib_ccx.c(+7 -0)📝
src/lib_ccx/myth.c(+7 -3)📝
src/lib_ccx/ocr.c(+48 -16)📝
src/lib_ccx/output.c(+7 -2)...and 23 more files
📄 Description
Summary
This PR contains comprehensive bug fixes from Phases 2-4 of the bug analysis cycle, addressing memory issues, buffer overruns, and Rust FFI safety across the entire codebase.
Phase 2: Memory Issues (78 fixes)
Memory Leak Fixes
Unsafe Realloc Pattern Fixes
ptr = realloc(ptr, ...)patternsFiles Modified (Phase 2)
src/lib_ccx/ocr.csrc/lib_ccx/ts_tables_epg.csrc/lib_ccx/utility.csrc/lib_ccx/avc_functions.csrc/lib_ccx/lib_ccx.csrc/lib_ccx/asf_functions.csrc/lib_ccx/telxcc.csrc/lib_ccx/ccx_encoders_srt.csrc/lib_ccx/ccx_encoders_helpers.csrc/lib_ccx/ccx_encoders_splitbysentence.csrc/lib_ccx/output.cPhase 3: Buffer Overruns (29 fixes)
Unsafe String Function Replacements
sprintfsnprintfwith size limitsstrcpystrncpyormemcpystrcatstrncatwith boundsFiles Modified (Phase 3)
src/lib_ccx/ccx_encoders_common.csrc/lib_ccx/ccx_encoders_sami.csrc/lib_ccx/ccx_encoders_smptett.csrc/lib_ccx/ccx_encoders_webvtt.csrc/lib_ccx/networking.csrc/lib_ccx/params.cPhase 4: Rust FFI Safety (89 fixes)
Safety Documentation
# Safetydocs to all 83 production FFI functionsPanic Prevention (FFI function bodies)
.try_into().unwrap()with safeascastsexpect()with safe error handlingpanic!/expect(), use defaultsunwrap()withunwrap_or()Clippy Fixes
assert!(false)withunreachable!()#[allow]attributes for acceptable test code patternsFiles Modified (Phase 4)
src/rust/src/lib.rssrc/rust/src/decoder/encoding.rssrc/rust/src/decoder/service_decoder.rssrc/rust/src/hardsubx/decoder.rssrc/rust/src/hardsubx/imgops.rssrc/rust/src/hardsubx/utility.rssrc/rust/src/libccxr_exports/*.rsTest Plan
unwrap()/expect()calls in FFI function bodiesStatistics
Related
This completes Phases 2-4 of the comprehensive bug analysis cycle:
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.