With a certain topology involving an octopus merge, git log --graph --oneline --all --color=never produces output which includes some ANSI escape code coloring. Attached is a script to reproduce the problem (creates a git repository in subdir log-format-test), along with sample graph and valgrind output (indicates some unitialialized memory access). I've observed the problem with Windows git versions 2.7.0, 2.5.3. I've NOT observed it with 1.9.5, On GNU/Linux the symptom only appears when running with valgrind, I tried versions 2.8.0, and 2.8.2.402.gedec370 (the last is where the valgrind output comes from)
* e98205a c | *[31m-[m[31m.[m 808603b merge a b | |\ \ |/ / / | | * 8886a4e b | * | 2d8743f a | |/ * | e09af19 1 |/ * 773004e 0
Attachment:
test-multiway-merge.sh
Description: Bourne shell script
==11287== Memcheck, a memory error detector ==11287== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==11287== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==11287== Command: /home/npostavs/src/git/git log --oneline --graph --color=never --all ==11287== ==11287== Conditional jump or move depends on uninitialised value(s) ==11287== at 0x4B0A48: strbuf_write_column (graph.c:79) ==11287== by 0x4B0B3F: graph_draw_octopus_merge (graph.c:799) ==11287== by 0x4B1440: graph_output_commit_line (graph.c:837) ==11287== by 0x4B1726: graph_next_line (graph.c:1126) ==11287== by 0x4B1A5F: graph_show_commit (graph.c:1197) ==11287== by 0x4BCF37: show_log (log-tree.c:601) ==11287== by 0x4BD723: log_tree_commit (log-tree.c:879) ==11287== by 0x441E8C: cmd_log_walk (log.c:345) ==11287== by 0x443961: cmd_log (log.c:660) ==11287== by 0x4050F9: run_builtin (git.c:350) ==11287== by 0x405218: handle_builtin (git.c:536) ==11287== by 0x4055AA: run_argv (git.c:582) ==11287== ==11287== Use of uninitialised value of size 8 ==11287== at 0x4B05A0: column_get_color_code (graph.c:73) ==11287== by 0x4B0A51: strbuf_write_column (graph.c:80) ==11287== by 0x4B0B3F: graph_draw_octopus_merge (graph.c:799) ==11287== by 0x4B1440: graph_output_commit_line (graph.c:837) ==11287== by 0x4B1726: graph_next_line (graph.c:1126) ==11287== by 0x4B1A5F: graph_show_commit (graph.c:1197) ==11287== by 0x4BCF37: show_log (log-tree.c:601) ==11287== by 0x4BD723: log_tree_commit (log-tree.c:879) ==11287== by 0x441E8C: cmd_log_walk (log.c:345) ==11287== by 0x443961: cmd_log (log.c:660) ==11287== by 0x4050F9: run_builtin (git.c:350) ==11287== by 0x405218: handle_builtin (git.c:536) ==11287== ==11287== Conditional jump or move depends on uninitialised value(s) ==11287== at 0x4B0AC5: strbuf_write_column (graph.c:82) ==11287== by 0x4B0B3F: graph_draw_octopus_merge (graph.c:799) ==11287== by 0x4B1440: graph_output_commit_line (graph.c:837) ==11287== by 0x4B1726: graph_next_line (graph.c:1126) ==11287== by 0x4B1A5F: graph_show_commit (graph.c:1197) ==11287== by 0x4BCF37: show_log (log-tree.c:601) ==11287== by 0x4BD723: log_tree_commit (log-tree.c:879) ==11287== by 0x441E8C: cmd_log_walk (log.c:345) ==11287== by 0x443961: cmd_log (log.c:660) ==11287== by 0x4050F9: run_builtin (git.c:350) ==11287== by 0x405218: handle_builtin (git.c:536) ==11287== by 0x4055AA: run_argv (git.c:582) ==11287== ==11287== Conditional jump or move depends on uninitialised value(s) ==11287== at 0x4B0A48: strbuf_write_column (graph.c:79) ==11287== by 0x4B0B6F: graph_draw_octopus_merge (graph.c:802) ==11287== by 0x4B1440: graph_output_commit_line (graph.c:837) ==11287== by 0x4B1726: graph_next_line (graph.c:1126) ==11287== by 0x4B1A5F: graph_show_commit (graph.c:1197) ==11287== by 0x4BCF37: show_log (log-tree.c:601) ==11287== by 0x4BD723: log_tree_commit (log-tree.c:879) ==11287== by 0x441E8C: cmd_log_walk (log.c:345) ==11287== by 0x443961: cmd_log (log.c:660) ==11287== by 0x4050F9: run_builtin (git.c:350) ==11287== by 0x405218: handle_builtin (git.c:536) ==11287== by 0x4055AA: run_argv (git.c:582) ==11287== ==11287== Use of uninitialised value of size 8 ==11287== at 0x4B05A0: column_get_color_code (graph.c:73) ==11287== by 0x4B0A51: strbuf_write_column (graph.c:80) ==11287== by 0x4B0B6F: graph_draw_octopus_merge (graph.c:802) ==11287== by 0x4B1440: graph_output_commit_line (graph.c:837) ==11287== by 0x4B1726: graph_next_line (graph.c:1126) ==11287== by 0x4B1A5F: graph_show_commit (graph.c:1197) ==11287== by 0x4BCF37: show_log (log-tree.c:601) ==11287== by 0x4BD723: log_tree_commit (log-tree.c:879) ==11287== by 0x441E8C: cmd_log_walk (log.c:345) ==11287== by 0x443961: cmd_log (log.c:660) ==11287== by 0x4050F9: run_builtin (git.c:350) ==11287== by 0x405218: handle_builtin (git.c:536) ==11287== ==11287== Conditional jump or move depends on uninitialised value(s) ==11287== at 0x4B0AC5: strbuf_write_column (graph.c:82) ==11287== by 0x4B0B6F: graph_draw_octopus_merge (graph.c:802) ==11287== by 0x4B1440: graph_output_commit_line (graph.c:837) ==11287== by 0x4B1726: graph_next_line (graph.c:1126) ==11287== by 0x4B1A5F: graph_show_commit (graph.c:1197) ==11287== by 0x4BCF37: show_log (log-tree.c:601) ==11287== by 0x4BD723: log_tree_commit (log-tree.c:879) ==11287== by 0x441E8C: cmd_log_walk (log.c:345) ==11287== by 0x443961: cmd_log (log.c:660) ==11287== by 0x4050F9: run_builtin (git.c:350) ==11287== by 0x405218: handle_builtin (git.c:536) ==11287== by 0x4055AA: run_argv (git.c:582) ==11287== ==11287== ==11287== HEAP SUMMARY: ==11287== in use at exit: 651,170 bytes in 191 blocks ==11287== total heap usage: 414 allocs, 223 frees, 1,756,967 bytes allocated ==11287== ==11287== LEAK SUMMARY: ==11287== definitely lost: 825 bytes in 8 blocks ==11287== indirectly lost: 1,515 bytes in 10 blocks ==11287== possibly lost: 0 bytes in 0 blocks ==11287== still reachable: 648,830 bytes in 173 blocks ==11287== suppressed: 0 bytes in 0 blocks ==11287== Rerun with --leak-check=full to see details of leaked memory ==11287== ==11287== For counts of detected and suppressed errors, rerun with: -v ==11287== Use --track-origins=yes to see where uninitialised values come from ==11287== ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 0 from 0)