Skip to content

tests: let the worktree fixture own its sandbox repositories - #7411

Open
msuozzo wants to merge 1 commit into
libgit2:mainfrom
msuozzo:push-vyolwtwxtknu
Open

msuozzo wants to merge 1 commit into
libgit2:mainfrom
msuozzo:push-vyolwtwxtknu

Conversation

@msuozzo

@msuozzo msuozzo commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

setup_fixture_worktree opens its repositories with cl_git_sandbox_init, and cleanup_fixture_worktree frees them, but clar still points at the last one. A later cleanup that calls cl_git_sandbox_cleanup before the next cl_git_sandbox_init frees it again. Running worktree::open and then network::fetchlocal under ASan reports a heap-use-after-free.

This adds cl_git_sandbox_init_unmanaged, which sets up a sandbox that the caller frees and removes, leaving the one clar tracks alone, and uses it for the fixture's repositories.

#7409 fixes the same problem in three individual tests, one of them in worktree::worktree. The two changes are independent, and with both, every worktree suite followed by network::fetchlocal is clean under ASan.

setup_fixture_worktree opens its repositories with cl_git_sandbox_init
and cleanup_fixture_worktree frees them, but clar still points at the
last one. A later cleanup that calls cl_git_sandbox_cleanup before the
next cl_git_sandbox_init frees it again: running worktree::open and
then network::fetchlocal under ASan reports a heap-use-after-free.

Add cl_git_sandbox_init_unmanaged, which sets up a sandbox that the
caller frees and removes, leaving the one clar tracks alone, and use
it for the fixture's repositories.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant