mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-02-03 21:23:48 +00:00
[PR #2031] [MERGED] Fix use-after-free bugs in Rust userdata handling #2835
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/2031
Author: @THE-Amrit-mahto-05
Created: 1/18/2026
Status: ✅ Merged
Merged: 1/18/2026
Merged by: @cfsmp3
Base:
master← Head:fix/rust-userdata-uaf📝 Commits (2)
e0ac126Fix use-after-free bugs in Rust userdata handling20b194aConsolidate Rust userdata fixes: UAF, bounds checks, and VBI safety📊 Changes
1 file changed (+22 additions, -12 deletions)
View changed files
📝
src/rust/src/es/userdata.rs(+22 -12)📄 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 reviewing userdata.rs, I found another instance of the same use-after-free pattern in the Unrecognized user data handling.
The current code creates a temporary Vec using .to_vec() and immediately extracts a raw pointer from it using .as_mut_ptr().
Because the temporary Vec is dropped right after .as_mut_ptr(), the pointer passed to dump() becomes dangling, resulting in use-after-free undefined behavior.
This is the same issue that was fixed earlier in this file.
Fix
Store the Vec in a local variable so its lifetime extends until after the dump() call:
This guarantees the backing memory remains valid for the duration of the call.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.