libgit2 / libgit2/libgit2sharp
Crash calling Repository.IsValid with corrupt .git/config
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- C#
- Estrelas
- 3.5k
- Forks
- 925
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
Reproduction steps
Add this to .git/config
[diff "mytool"] command = c:\path\to\my\tool\MyToolComparer.exe
This will cause the following effect for git
c:\my\git\repo> git status
fatal: bad config line 8 in file .git/config
Then call Repository.IsValid(@"c:\my\git\repo\.git") which is turn calls Proxy.git_repository_open_ext(path, RepositoryOpenFlags.NoSearch, null);
This fails because the return value from NativeMethods.git_repository_open_ext(out repo, path, flags, ceilingDirs) is not checked for error prior to freeing the out parameter repo (which is already free'd when there is an error condition in int git_repository_open_ext(git_repository **repo_ptr, const char *start_path, unsigned int flags, const char *ceiling_dirs))
Expected behavior
LibGit2Sharp.LibGit2SharpException
Actual behavior
Access violation (0xC0000005) in void git_repository_free(git_repository *repo) when dereferencing the null repo
Version of LibGit2Sharp (release number or SHA1)
0.27.0.34
Operating system(s) tested; .NET runtime tested
Windows 10 Pro 1909 - .NET CLR Version v4.0.30319
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece em Repository.IsValid e rastreie sua chamada por meio de Proxy.git_repository_open_ext até NativeMethods.git_repository_open_ext; em seguida, inspecione o caminho de erro nativo que envolve git_repository_free. Reproduza o caso de um .git/config corrompido no Windows e verifique se ele gera LibGit2SharpException em vez de uma violação de acesso; adicione ou atualize a cobertura para esse cenário se a estrutura de testes existente indicar um local adequado.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- csharp, git
- Domínio
- tooling
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 45/100