From: Jeff King Date: Mon, 18 Oct 2010 17:40:31 GMT Subject: Re: [CRASH] git segfaults on invalid binary diff Message-ID: <20101018174031.GA9511@sigill.intra.peff.net> In-Reply-To: <20101018180632.7eb40628@wai> On Mon, Oct 18, 2010 at 06:06:32PM +0200, Rafaël Carré wrote: > I noticed git crashed on a patch generated with: > git show --full-index --pretty=email > > (I had forgotten --binary) > > % git --version > git version 1.7.3.1.120.g38a18 > % mkdir test > % cd test > % git init > Initialized empty Git repository in /home/fun/test/.git/ > % git am ~/bad.diff > Applying: foo bar > Segmentation fault (core dumped) > Patch failed at 0001 foo bar > When you have resolved this problem run "git am --resolved". > If you would prefer to skip this patch, instead run "git am --skip". > To restore the original branch and stop patching run "git am --abort". > % cat ~/bad.diff Hmm, the key seems to be applying it in a new repo without the actual objects. Git will fall back to trying to apply based on the index line, and that is presumably where the bug is. I'll try to work up a patch. -Peff