mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-02-03 21:23:48 +00:00
[PR #1807] [MERGED] fix(lib_ccx): replace unsafe string functions with bounds-checked versions #2544
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/1807
Author: @cfsmp3
Created: 12/13/2025
Status: ✅ Merged
Merged: 12/13/2025
Merged by: @cfsmp3
Base:
master← Head:fix/phase3-buffer-safety-medium-priority📝 Commits (9)
bff08befix(encoders): replace unsafe string functions with bounds-checked versions8af19dffix(lib_ccx): replace remaining unsafe string functions with bounds-checked versions6e295acfix(ccx_encoders_spupng): add NULL checks and fix memory leaksb3c3bdcfix(ocr): add NULL checks and fix memory leaks1869c4cfix(mcc_encoder): prevent buffer overruns and add OOM checks8329257fix(708_output): replace sprintf with snprintf for buffer safetyaf5e36cstyle: fix clang-format issues in macro definitions87b0d22fix(ts_tables_epg): add NULL checks and fix memory leaks68da0a0style: fix clang-format issues📊 Changes
20 files changed (+466 additions, -150 deletions)
View changed files
📝
src/lib_ccx/asf_functions.c(+6 -6)📝
src/lib_ccx/ccx_common_timing.c(+8 -2)📝
src/lib_ccx/ccx_decoders_708_output.c(+170 -64)📝
src/lib_ccx/ccx_decoders_708_output.h(+1 -1)📝
src/lib_ccx/ccx_encoders_common.c(+4 -4)📝
src/lib_ccx/ccx_encoders_curl.c(+8 -4)📝
src/lib_ccx/ccx_encoders_g608.c(+3 -3)📝
src/lib_ccx/ccx_encoders_helpers.c(+4 -4)📝
src/lib_ccx/ccx_encoders_mcc.c(+40 -21)📝
src/lib_ccx/ccx_encoders_splitbysentence.c(+7 -3)📝
src/lib_ccx/ccx_encoders_spupng.c(+28 -5)📝
src/lib_ccx/ccx_encoders_ssa.c(+6 -6)📝
src/lib_ccx/general_loop.c(+9 -1)📝
src/lib_ccx/lib_ccx.c(+10 -8)📝
src/lib_ccx/matroska.c(+7 -1)📝
src/lib_ccx/ocr.c(+83 -9)📝
src/lib_ccx/output.c(+4 -2)📝
src/lib_ccx/telxcc.c(+3 -3)📝
src/lib_ccx/ts_functions.c(+1 -1)📝
src/lib_ccx/ts_tables_epg.c(+64 -2)📄 Description
Summary
Replace sprintf/strcpy/strcat with bounds-checked versions in files identified in Phase 3.1 of the buffer safety audit. This completes all dangerous function pattern fixes.
Files Modified
Medium Priority (previous commit)
Low Priority (latest commit)
Notable Fixes
ccx_encoders_splitbysentence.c: Fixed undefined behavior where
strcpy()was used with overlapping memory regions. Replaced withmemmove().ccx_encoders_curl.c: Added OOM check for malloc allocation that was previously unchecked.
lib_ccx.c: Fixed buffer size calculation - was allocating
strlen + 10but neededstrlen + 12for the format string.matroska.c: Protected against malformed language codes that could cause buffer overflow from untrusted file input.
Test plan
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.