mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-02-03 21:23:48 +00:00
[PR #1804] [MERGED] fix(mcc_encoder): prevent buffer overruns and add OOM checks #2541
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/1804
Author: @cfsmp3
Created: 12/13/2025
Status: ✅ Merged
Merged: 12/13/2025
Merged by: @cfsmp3
Base:
master← Head:fix/mcc-encoder-buffer-overruns📝 Commits (1)
37fed5efix(mcc_encoder): prevent buffer overruns and add OOM checks📊 Changes
1 file changed (+40 additions, -21 deletions)
View changed files
📝
src/lib_ccx/ccx_encoders_mcc.c(+40 -21)📄 Description
Summary
This PR fixes multiple buffer overrun vulnerabilities and missing out-of-memory (OOM) checks in the MCC (MacCaption) encoder in
src/lib_ccx/ccx_encoders_mcc.c.Issues Found and Fixed
1. Missing OOM Checks (2 instances)
mcc_encode_cc_datacompressed_data_bufferadd_boilerplatebuff_ptrFix: Added
fatal(EXIT_NOT_ENOUGH_MEMORY, ...)checks after each allocation.2. Unsafe
sprintfCalls (12 instances)All
sprintfcalls into fixed-size buffers were replaced withsnprintf:mcc_encode_cc_datacompressed_data_buffergenerate_mcc_headeruuid_strgenerate_mcc_headerdate_strgenerate_mcc_headertime_strgenerate_mcc_headertcr_str(7 locations)3. Unsafe
strcatCallBefore:
After:
4. Unsafe
vsprintfindebug_logBefore:
After:
5. Inefficient
sprintfLoop inrandom_charsBefore:
After:
6. Uninitialized Buffer in Default Case
Added
tcr_str[0] = '\0';in the default case of the framerate switch to prevent using uninitialized data.Code Changes Summary
malloc()without NULL checksprintf()callssnprintf()callsstrcat()callsvsprintf()callsvsnprintf()callsSecurity Impact
These fixes prevent:
MCC output is used for professional broadcast captioning, making reliability important.
Test Plan
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.