libgit2 / libgit2/libgit2sharp
Passing null to Repository.Discover(...) causes AccessViolationException / process termination
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 3.5k
- Forks
- 925
- PR merge metrics
- No merged PRs in 30d
Description
Reproduction steps
- Pass
nulltoRepository.Discover(...)
Expected behavior
A friendly exception. 😉
Actual behavior
Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at LibGit2Sharp.Core.NativeMethods.git_repository_discover(LibGit2Sharp.Core.Handles.GitBuf, LibGit2Sharp.Core.FilePath, Boolean, LibGit2Sharp.Core.FilePath)
at LibGit2Sharp.Core.Proxy+<>c__DisplayClass3e.<git_repository_discover>b__3d(LibGit2Sharp.Core.Handles.GitBuf)
at LibGit2Sharp.Core.Proxy.ConvertPath(System.Func`2<LibGit2Sharp.Core.Handles.GitBuf,Int32>)
at LibGit2Sharp.Core.Proxy.git_repository_discover(LibGit2Sharp.Core.FilePath)
at LibGit2Sharp.Repository.Discover(System.String)
at GitHub.Services.GitService.GetRepository(System.String)
Version of LibGit2Sharp (release number or SHA1)
0.23.1.0
Operating system(s) tested; .NET runtime tested
Windows 10 + .NET v4.0.30319
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The failing entry point is Repository.Discover(String), which reaches Core.Proxy.git_repository_discover and NativeMethods.git_repository_discover in the stack trace. Start there by tracing how a null path is passed to the native call, then add a regression test and verify that null produces a managed exception instead of terminating the process.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, git
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100