mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-02-03 21:23:48 +00:00
[PR #1828] fix: Comprehensive bug fixes - Phases 2-4 (Memory, Buffer, Rust FFI) #2585
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?
Original Pull Request: https://github.com/CCExtractor/ccextractor/pull/1828
State: closed
Merged: Yes
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