mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-04-18 20:12:50 +00:00
[PR #2011] [MERGED] Fix allocator mismatch in Rust demuxer (use malloc/free instead of Box) #2812
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/2011
Author: @THE-Amrit-mahto-05
Created: 1/10/2026
Status: ✅ Merged
Merged: 1/10/2026
Merged by: @cfsmp3
Base:
master← Head:fix/demuxer-allocator-mismatch📝 Commits (1)
a77c21cfix: allocator mismatch in demuxer (use malloc/free instead of Box)📊 Changes
2 files changed (+55 additions, -21 deletions)
View changed files
📝
src/rust/src/demuxer/common_types.rs(+11 -6)📝
src/rust/src/libccxr_exports/demuxer.rs(+44 -15)📄 Description
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
description
In the Rust demuxer, PID_buffers and PIDs_programs were previously allocated using Rust’s Box and sometimes freed in situations where the memory could have been allocated by C. This could cause undefined behavior or crashes when syncing the demuxer state between Rust and C.
This change updates those allocations to C-style (malloc/calloc) and frees them using free, ensuring that Rust and C memory management are fully compatible.
Why
The demuxer’s synchronization logic could previously free pointers incorrectly, leading to crashes during repeated demuxer state updates or in multi-threaded scenarios. Using C-compatible allocation ensures safe interoperability between Rust and C.
Testing
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.