Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for segfault when null hunks are passed to callbacks #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xloem
Copy link

@xloem xloem commented Jul 27, 2022

I'm not certain what the "right" solution for this is, but as-is there is a segfault when diffs are printed.

A null hunk pointer is passed from https://github.com/libgit2/libgit2/blob/main/src/libgit2/diff_print.c#L164 via https://github.com/bold84/cppgit2/blob/master/src/diff.cpp#L199 to the hunk constructor, causing dereference of null.

This quick patch changes the hunk constructor to initialise to zeros if passed a null value.

This breaks parallelism with line and delta, which do not have such a check, but it prevents the segfault.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant