malloc memory corruption on merge-tree with leading newline
From: Stefan Frühwirth <hidden>
Date: 2016-06-15 23:08:14
Hi, in one specific circumstance, git-merge-tree exits with a segfault caused by "*** Error in `git': malloc(): memory corruption (fast)": There has to be at least one commit first (as far as I can tell it doesn't matter what content). Then create a tree containing a file with a leading newline character (\n) followed by some random string, and another tree with a file containing a string without leading newline. Now merge trees: Segmentation fault. There is a test case[1] kindly provided by chrisrossi, which he crafted after I discovered the problem[2] in the context of Pylons/acidfs. Best, Stefan [1] https://gist.github.com/chrisrossi/f09c8bed70b364f9f12e [2] https://github.com/Pylons/acidfs/issues/3 For in-line reference, here's the test case: git init bug cd bug echo b > a git add a git commit -m "first commit" echo > b echo -n a >> b git add b git commit -m "second commit, first branch" git checkout HEAD~1 git checkout -b other echo -n a > b git add b git commit -m "second commit, second branch" git merge-tree HEAD~1 master other cd .. rm -rf bug