#7377·libgit2

[Bug] git_clone crashes on an unregistered URL scheme

Author: AvaCodenCreated Sep 17, 2026Updated Sep 17, 2026

Calling git_clone with an unregistered URL scheme terminates the process on Windows instead of returning an error.

Reproduction steps

The failing native call is equivalent to:

c
git_repository *repo = NULL;
git_clone_options options = GIT_CLONE_OPTIONS_INIT;

git_clone(
    &repo,
    "foo://example.com",
    "C:\\Temp\\libgit2-unknown-scheme",
    &options);

I reproduced this through LibGit2Sharp 0.32.0 / LibGit2Sharp.NativeBinaries 2.0.324, running each case in a separate process because the failure terminates the test runner.

The crash is unchanged with default clone options or with each of these options added individually: bare clone, no checkout, automatic proxy selection, credential callback, certificate callback, and progress callbacks. As a control, https://example.invalid/x.git returns a normal libgit2 error.

Expected behavior

git_clone returns an error for an unregistered scheme, with a message such as unsupported URL protocol.

libgit2 1.3 returned that error for the same input.

Actual behavior

The process terminates with Windows exception code 0xc0000005 inside git_clone in git2-5853918.dll. A managed host reports the last native frame as:

LibGit2Sharp.Core.NativeMethods.git_clone(...)

No libgit2 error reaches the caller.

Version of libgit2

1.8.6.0, from LibGit2Sharp.NativeBinaries 2.0.324.

Operating system tested

Windows x64