]> git.ipfire.org Git - thirdparty/git.git/commit - t/t5318-commit-graph.sh
t/t5318: introduce failing 'git commit-graph write' tests
authorTaylor Blau <me@ttaylorr.com>
Thu, 5 Sep 2019 22:04:53 +0000 (18:04 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Sep 2019 17:55:53 +0000 (10:55 -0700)
commit23424ea7597fa17b96c82001b281a5d21f5b4874
treee9595c141a18b20e6364021ed52b28abe11b44ae
parent745f6812895b31c02b29bdfe4ae8e5498f776c26
t/t5318: introduce failing 'git commit-graph write' tests

When invoking 'git commit-graph' in a corrupt repository, one can cause
a segfault when ancestral commits are corrupt in one way or another.
This is due to two function calls in the 'commit-graph.c' code that may
return NULL, but are not checked for NULL-ness before dereferencing.

Before fixing the bug, introduce two failing tests that demonstrate the
problem. The first test corrupts an ancestral commit's parent to point
to a non-existent object. The second test instead corrupts an ancestral
tree by removing the 'tree' information entirely from the commit. Both
of these cases cause segfaults, each at different lines.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Acked-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5318-commit-graph.sh