diff options
author | Jeff King <peff@peff.net> | 2018-06-11 04:35:45 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-06-11 10:56:06 -0700 |
commit | 47cc91310a81ca606e6bebcccf168bc1cb297d8e (patch) | |
tree | d5430d3ac993aae8378490c1751ac92df425c834 /t/diff-lib | |
parent | t7415: don't bother creating commit for symlink test (diff) | |
download | tgif-47cc91310a81ca606e6bebcccf168bc1cb297d8e.tar.xz |
fsck: avoid looking at NULL blob->object
Commit 159e7b080b (fsck: detect gitmodules files,
2018-05-02) taught fsck to look at the content of
.gitmodules files. If the object turns out not to be a blob
at all, we just complain and punt on checking the content.
And since this was such an obvious and trivial code path, I
didn't even bother to add a test.
Except it _does_ do one non-trivial thing, which is call the
report() function, which wants us to pass a pointer to a
"struct object". Which we don't have (we have only a "struct
object_id"). So we erroneously pass a NULL object to
report(), which gets dereferenced and causes a segfault.
It seems like we could refactor report() to just take the
object_id itself. But we pass the object pointer along to
a callback function, and indeed this ends up in
builtin/fsck.c's objreport() which does want to look at
other parts of the object (like the type).
So instead, let's just use lookup_unknown_object() to get
the real "struct object", and pass that.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/diff-lib')
0 files changed, 0 insertions, 0 deletions