3
26
Fork
You've already forked mere
1

Fix double-free of archive_hash in createPackageArtifact #104

Merged
jhuntwork merged 1 commit from packaging-archive-hash-double-free into main 2026年07月10日 04:11:42 +02:00

Two late-stage error branches in createPackageArtifact (the
result_package_name and result_signature dupe failures) manually freed
archive_hash even though an errdefer registered earlier for archive_hash
was still armed, causing a double-free when OOM struck at either of
those two allocation sites.

Add a regression test that runs createPackageArtifact once to learn its
real allocation count, then re-runs it with a FailingAllocator targeting
the last allocation on the happy path (result_signature's dupe) to
deterministically reproduce the double-free. Verified the test fails
against the unfixed code (GeneralPurposeAllocator reports the double
free at the exact two call sites) and passes with the fix.

Two late-stage error branches in createPackageArtifact (the result_package_name and result_signature dupe failures) manually freed archive_hash even though an errdefer registered earlier for archive_hash was still armed, causing a double-free when OOM struck at either of those two allocation sites. Add a regression test that runs createPackageArtifact once to learn its real allocation count, then re-runs it with a FailingAllocator targeting the last allocation on the happy path (result_signature's dupe) to deterministically reproduce the double-free. Verified the test fails against the unfixed code (GeneralPurposeAllocator reports the double free at the exact two call sites) and passes with the fix.
Fix double-free of archive_hash in createPackageArtifact
All checks were successful
/ test (pull_request) Successful in 6m36s
7ca3c45643
Two late-stage error branches in createPackageArtifact (the
result_package_name and result_signature dupe failures) manually freed
archive_hash even though an errdefer registered earlier for archive_hash
was still armed, causing a double-free when OOM struck at either of
those two allocation sites.
Add a regression test that runs createPackageArtifact once to learn its
real allocation count, then re-runs it with a FailingAllocator targeting
the last allocation on the happy path (result_signature's dupe) to
deterministically reproduce the double-free. Verified the test fails
against the unfixed code (GeneralPurposeAllocator reports the double
free at the exact two call sites) and passes with the fix.
jhuntwork deleted branch packaging-archive-hash-double-free 2026年07月10日 04:11:42 +02:00
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
merelinux/mere!104
Reference in a new issue
merelinux/mere
No description provided.
Delete branch "packaging-archive-hash-double-free"

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?