libgit2 / libgit2/libgit2sharp
Passing null to Repository.Discover(...) causes AccessViolationException / process termination
未关闭
还没有人认领这个 Issue。
- 主要语言
- C#
- 星标
- 3.5k
- 派生
- 925
- PR 合并指标
- 30 天内没有已合并 PR
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
失败的入口点是 Repository.Discover(String),它在堆栈跟踪中到达 Core.Proxy.git_repository_discover 和 NativeMethods.git_repository_discover。先从这里开始,跟踪 null 路径是如何传递给原生调用的,然后添加回归测试,并验证 null 会产生托管异常,而不是终止进程。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp, git
- 领域
- api, backend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 38/100