mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-02-03 21:23:48 +00:00
[PR #2027] [CLOSED] Fix unsafe temporary Vec pointer usage in userdata.rs #2834
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/2027
Author: @THE-Amrit-mahto-05
Created: 1/17/2026
Status: ❌ Closed
Base:
master← Head:fix/rust-ffi-uaf-userdata📝 Commits (1)
7863ba0Fix Rust FFI use-after-free in userdata.rs📊 Changes
1 file changed (+5 additions, -3 deletions)
View changed files
📝
src/rust/src/es/userdata.rs(+5 -3)📄 Description
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
Description
While working on the Rust FFI code in userdata.rs, I noticed that a few calls were passing pointers created from temporary Vecs (to_vec().as_mut_ptr()) directly into C functions.
This is unsafe because the temporary Vec is dropped immediately after the statement, which can leave the C side with a dangling pointer and result in undefined behavior.
Fix
This change does not alter behavior and is limited to fixing lifetime safety at the FFI boundary.
Proposed Changes
cc_datais already a slice returned fromread_bytes(), use its pointer directly.The C function
store_hdcc()copies the data usingmemcpy()(seesequencing.c:70), so the pointer only needs to be valid during the call🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.