libgit2 / libgit2/libgit2sharp
Crash calling Repository.IsValid with corrupt .git/config
Personne n'a encore pris cette issue.
- Langage dominant
- C#
- Étoiles
- 3.5k
- Forks
- 925
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par Repository.IsValid et suivez son appel via Proxy.git_repository_open_ext jusqu’à NativeMethods.git_repository_open_ext, puis examinez le chemin d’erreur natif impliquant git_repository_free. Reproduisez le cas d’un .git/config corrompu sous Windows et vérifiez qu’il lève LibGit2SharpException au lieu de provoquer une violation d’accès mémoire ; ajoutez ou mettez à jour la couverture de ce scénario si la structure de tests existante indique un emplacement approprié.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- csharp, git
- Domaine
- tooling
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100