public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Jake Roggenbuck <jakeroggenbuck2@gmail.com>
To: roggenbuckjake@gmail.com
Cc: git@vger.kernel.org, Jake Roggenbuck <jakeroggenbuck2@gmail.com>
Subject: [PATCH 0/1] Exit on invalid diff status of diff_filepair
Date: Tue,  7 Jan 2025 22:01:50 -0800	[thread overview]
Message-ID: <20250108060151.7218-1-jakeroggenbuck2@gmail.com> (raw)
In-Reply-To: <CAEUC8gmgq_yViedLGHOeSyvR9rQK+O-8Fh9wzds=2+326ngUjw@mail.gmail.com>

Hi all,

Git showed that object files were empty, so I manually removed them.
After removing a few object files, I ran `git diff` and I got a segfault.

I have since narrowed down the source of the error to a usage of
`diff_filepair`. I also noticed that the `status` field of `diff_filepair`
does not get set and stays a zero value. My fix is to check for that invalid
status character and exit gracefully with an error message.

I modeled the behavior of this patch after what `git log` does in the same
situation. `git log` will exit with a message that reads `bad object HEAD`.

I initially found this segfault when using git while working on a school
assignment. I am really interested in helping fix this segfault.
I'd be happy to hear any feedback.

Thank you!


Jake Roggenbuck (1):
  Exit on invalid diff status of diff_filepair

 diff.c | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.47.0


  reply	other threads:[~2025-01-08  6:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-19  3:02 bug: Segfault with git diff jake roggenbuck
2025-01-08  6:01 ` Jake Roggenbuck [this message]
2025-01-08  6:01   ` [PATCH 1/1] Exit on invalid diff status of diff_filepair Jake Roggenbuck
2025-04-30 18:50     ` Jake Roggenbuck
2025-04-30 18:50       ` Jake Roggenbuck
2025-05-01  6:16       ` Eric Sunshine
2025-05-01 13:23         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250108060151.7218-1-jakeroggenbuck2@gmail.com \
    --to=jakeroggenbuck2@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=roggenbuckjake@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox