libgit2 / libgit2/libgit2sharp

Passing null to Repository.Discover(...) causes AccessViolationException / process termination

Đang mở
#1,592 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
C#
Star
3.5k
Fork
925
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Reproduction steps
  1. Pass null to Repository.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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Điểm vào đang bị lỗi là Repository.Discover(String), đi tới Core.Proxy.git_repository_discover và NativeMethods.git_repository_discover trong stack trace. Bắt đầu từ đó bằng cách theo dõi cách một đường dẫn null được truyền vào lệnh gọi native, sau đó thêm một bài kiểm thử hồi quy và xác minh rằng null tạo ra một managed exception thay vì chấm dứt tiến trình.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
csharp, git
Lĩnh vực
api, backend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
38/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.