Skip to content

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
Development

Successfully merging this pull request may close these issues.

1 participant