# [BUG] Memory corruption crash with "git bisect start"

2 messages from 2017-02-14 to 2017-02-14. Participants: Maxim Kuvyrkov, Christian Couder.
Thread: https://gitlist.dev/t/45138

## Maxim Kuvyrkov, 2017-02-14 11:56

Subject: [BUG] Memory corruption crash with "git bisect start"
Message-ID: <A7AEC719-6E15-4622-8E21-3E11BAF74A3C@linaro.org>
URL: https://gitlist.dev/e/A7AEC719-6E15-4622-8E21-3E11BAF74A3C%40linaro.org

```
I'm seeing the following memory corruption crash on a script-constructed repo when starting git bisect.  I'm seeing this crash both with system git of Ubuntu Xenial and with freshly-compiled git master from the official repo.

The log of the crash is attached.

It is possible that the bug is in Xenial glibc, in which case -- please let me know and I will take it up with the glibc developers.

To reproduce the crash:

<snip>
# Create a repo with 42 files, and change all of them.
rm -rf .git
git init
for i in `seq 1 42`; do echo 0 > f$i; git add f$i; echo 1 > f$i; done
git commit -m 0

# Download script to generate bisect history:
pushd ../
wget https://git.linaro.org/people/maxim.kuvyrkov/tree-bisect.git/plain/construct-tree.sh
popd

# Construct tree for bisect.  This script creates a history graph for all permutations of changed files up to "2" in depth.
# The goal of the script is to assist in reducing testcases for compiler/toolchain development.
../construct-tree.sh -d 2

# Trigger crash
git bisect start bottom top
</snip>

It is interesting that "42" number files is boundary.  The crash does not occur with history generated from 41 or fewer files, and only occurs with 42 or more files.  It appears that the contents of the files is not relevant for the crash.

--
Maxim Kuvyrkov
www.linaro.org



```

## Christian Couder, 2017-02-14 14:52

Subject: Re: [BUG] Memory corruption crash with "git bisect start"
Message-ID: <CAP8UFD12tQmWRV29BLO+KJGcGHXOqPaOLbovL7kTBHPWdyMM3g@mail.gmail.com>
URL: https://gitlist.dev/e/CAP8UFD12tQmWRV29BLO%2BKJGcGHXOqPaOLbovL7kTBHPWdyMM3g%40mail.gmail.com
In-Reply-To: <A7AEC719-6E15-4622-8E21-3E11BAF74A3C@linaro.org>

```
On Tue, Feb 14, 2017 at 12:56 PM, Maxim Kuvyrkov
<maxim.kuvyrkov@linaro.org> wrote:
> I'm seeing the following memory corruption crash on a script-constructed repo when starting git bisect.  I'm seeing this crash both with system git of Ubuntu Xenial and with freshly-compiled git master from the official repo.
>
> The log of the crash is attached.

Yeah, thanks for the report.

I took a look and it looks like git bisect crashes when it runs git
show-branch and it can be reproduced with just `git show-branch
bottom` instead of `git bisect start bottom top`.

> It is possible that the bug is in Xenial glibc, in which case -- please let me know and I will take it up with the glibc developers.

I have Ubuntu GLIBC 2.23-0ubuntu5 and I get a crash too.

```
