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

[BUG] segmentation fault in git-diff

From
Érico Rolim <erico.erc@gmail.com>
Date
Apr 9, 2020, 22:22 UTC
Message-ID
<CAFDeuWO+2JEGudtnHZvSsSUOVRR83U9ziLEjSoDyMWxYhvDMKg@mail.gmail.com>
Hey there!

I have found a bug in the git-diff utility, which is reproducible in the next branch. In any repository, if I run

    git diff :/any/path/

(The important part is the trailing forward slash. No slash will generate either a valid diff or an error message about the path not being known. ":/" also works without issue)

it will trigger a SIGSEV. I have traced that back to the refs_read_raw_ref() function, where it seems the ref_store parameter passed to it is 0x0 (according to GDB). It's always possible to include a null-check in that function to fix the issue, but I don't think that'd be the best solution. I can attempt to fix it, but I don't know what (and where) the proper solution would be, because I don't know what the expected behavior is here, nor where exactly it should fail. Do you think this could also warrant the creation of a test?

I don't know what the best debug resources (valgrind output, core file from gdb) would be, but I can provide them if necessary.

Thanks,
Érico Nogueira
Next: Junio C Hamano
Message 1 of 10 in “[BUG] segmentation fault in git-diff”
  1. Érico RolimApr 9, 2020
  2. Junio C HamanoApr 9, 2020
  3. Junio C HamanoApr 9, 2020
  4. Junio C HamanoApr 9, 2020
  5. Junio C HamanoApr 9, 2020
  6. Jeff KingApr 9, 2020
  7. Re* [BUG] segmentation fault in git-diffJunio C Hamano, Apr 10, 2020
  8. Érico RolimApr 10, 2020
  9. Jeff KingApr 10, 2020
  10. Junio C HamanoApr 10, 2020

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.