Subject: log -L crash (Re: [PATCH V5 13/17] Add parent rewriting to line history browser)

From: Jonathan Nieder <[email-masked]>
Date: Mon, 30 Aug 2010 12:10:07 -0500

Hi Bo et al,

The following test fails (segfaults) for me.  It bisects to 83361f5
(Add parent rewriting to line history browser, 2010-08-11).  Notes
from --valgrind:

	Invalid read of size 4
	   at assign_parents_range (line.c:1069)
	   by cmd_line_log_walk (line.c:1403)
	   by cmd_log (log.c:619)
	   by handle_internal_command (git.c:270)
	   by main (git.c:470)
	 Address 0x432a90c is 4 bytes inside a block of size 8 free'd
	   at free (vg_replace_malloc.c:366)
	   by assign_range_to_parent (line.c:964)
	   by assign_parents_range (line.c:1036)
	   by cmd_line_log_walk (line.c:1403)
	   by cmd_log (log.c:619)
	   by handle_internal_command (git.c:270)
	   by main (git.c:470)
 
	Invalid read of size 4
	   at assign_parents_range (line.c:1041)
	   by cmd_line_log_walk (line.c:1403)
	   by cmd_log (log.c:619)
	   by handle_internal_command (git.c:270)
	   by main (git.c:470)
	 Address 0x0 is not stack'd, malloc'd or (recently) free'd

	Process terminating with default action of signal 11 (SIGSEGV): dumping core
	 Access not within mapped region at address 0x0
	   at assign_parents_range (line.c:1041)
	   by cmd_line_log_walk (line.c:1403)
	   by cmd_log (log.c:619)
	   by handle_internal_command (git.c:270)
	   by main (git.c:470)
	 If you believe this happened as a result of a stack
	 overflow in your program's main thread (unlikely but
	 possible), you can try to increase the size of the
	 main thread stack using the --main-stacksize= flag.
	 The main thread stack size used in this run was 8388608.

Ideas?

diff --git a/t/t0011-crash.sh b/t/t0011-crash.sh
index e69de29..5cb3ef3 100644
--- a/t/t0011-crash.sh
+++ b/t/t0011-crash.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+test_description=crash
+. ./test-lib.sh
+
+test_expect_success "doesn't crash" '
+	GIT_DIR="$TEST_DIRECTORY"/../.git \
+		git log -L "/while (1) {/,/}/" git.c
+'
+
+test_done
--