git/list[1] front-page[2] threads[3] people[4] search[5] about
 

segfault for git log --graph --no-walk --grep a

From
THThomas Haller <thom311@gmail.com>
Date
Feb 8, 2013, 23:52 UTC
Message-ID
<201302090052.22053.thom311@gmail.com>
Hallo,

I just found that git crashes with a segmentation fault when calling $ git log --graph --no-walk --grep pattern

It happens both for version 1.7.10.4 from Debian (wheezy,amd64) and a fresh compiled git from github (git.git repository, master).

For the error to occure, the pattern must match the commit message in HEAD.
How to reproduce:
  git init .
  git commit -m 'text1' --allow-empty
  git commit -m 'text2' --allow-empty
  git log --graph --no-walk --grep 'text2'
And here is coredump I got:

Core was generated by `git log --graph --no-walk --grep text2'. Program terminated with signal 11, Segmentation fault. #0 __strlen_sse42 () at ../sysdeps/x86_64/multiarch/strlen-sse4.S:32 #1 0x00000000004cc13e in commit_match (opt=0x7fffbd0ee500, commit=0x216d1a8) at revision.c:2306 #2 get_commit_action (revs=0x7fffbd0ee500, commit=0x216d1a8) at revision.c:2338 #3 0x00000000004984b4 in graph_is_interesting (commit=<optimized out>, graph=<error reading variable: Unhandled dwarf expression opcode 0xfa>) at graph.c:330 #4 0x0000000000498569 in first_interesting_parent (graph=graph@entry=0x21629c0) at graph.c:369 #5 0x000000000049965e in graph_update (graph=0x21629c0, commit=<optimized out>) at graph.c:593 #6 0x00000000004cc7a9 in get_revision (revs=revs@entry=0x7fffbd0ee500) at revision.c:2580 #7 0x000000000043988a in cmd_log_walk (rev=rev@entry=0x7fffbd0ee500) at builtin/log.c:309 #8 0x000000000043a398 in cmd_log (argc=9, argv=0x2162930, prefix=0x0) at builtin/log.c:582 #9 0x0000000000405988 in run_builtin (argv=0x2162930, argc=9, p=0x751438) at git.c:281 #10 handle_internal_command (argc=9, argv=0x2162930) at git.c:443 #11 0x0000000000404df2 in run_argv (argv=0x7fffbd0eec00, argcp=0x7fffbd0eec0c) at git.c:489 #12 main (argc=9, argv=0x2162930) at git.c:564

it happens in file revision.c:2306 because "commit->buffer" is zero:
                retval = grep_buffer(&opt->grep_filter,
                                     commit->buffer, strlen(commit->buffer));

thank you all, for this awesome software. Thomas

Next: Junio C Hamano
Message 1 of 26 in “segfault for git log --graph --no-walk --grep a”
  1. Thomas HallerFeb 8, 2013
  2. Junio C HamanoFeb 9, 2013
  3. Junio C HamanoFeb 9, 2013
  4. Jeff KingFeb 9, 2013
  5. Junio C HamanoFeb 9, 2013
  6. Junio C HamanoFeb 9, 2013
  7. Jeff KingFeb 9, 2013
  8. Jeff KingFeb 9, 2013
  9. Jeff KingFeb 11, 2013
  10. Junio C HamanoFeb 11, 2013
  11. Junio C HamanoFeb 11, 2013
  12. Jeff KingFeb 11, 2013
  13. Junio C HamanoFeb 11, 2013
  14. log: re-encode commit messages before greppingJeff King, Feb 11, 2013
  15. Junio C HamanoFeb 11, 2013
  16. Jeff KingFeb 11, 2013
  17. t4210-log-i18n: spell encoding name "UTF-8" correctlyJohannes Sixt, Feb 25, 2013
  18. Jeff KingFeb 25, 2013
  19. Junio C HamanoFeb 25, 2013
  20. Jeff KingFeb 25, 2013
  21. Johannes SixtFeb 26, 2013
  22. Torsten BögershausenFeb 25, 2013
  23. Torsten BögershausenFeb 25, 2013
  24. Jeff KingFeb 25, 2013
  25. Junio C HamanoFeb 9, 2013
  26. Jeff KingFeb 9, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.