git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Possible segfault introduced in commit.c
@ 2012-04-25  7:59 Michael Mueller
  2012-04-25 11:14 ` Jeff King
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Mueller @ 2012-04-25  7:59 UTC (permalink / raw)
  To: git

Hi all,

As you might already know, we analyze git regularly with Sentry (our
static analysis tool).  Today it picked up a new NULL pointer
dereference in commit.c:366:

    void commit_list_reverse(struct commit_list **list_p)
    {
        struct commit_list *prev = NULL, *curr = *list_p, *next;

        if (!list_p)
            return;
        /* function continues... */
    }

list_p is dereferenced on the first line, then tested for NULL on
the very next statement.  If it's possible that list_p is NULL, this
will be a segfault.  If it can't be NULL, then the check is
unnecessary (and probably misleading).

Introduced here:
https://github.com/gitster/git/commit/fbc08ea

Best,
Mike

-- 
Mike Mueller
Phone: (401) 405-1525
Email: mmueller@vigilantsw.com

http://www.vigilantsw.com/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-04-30 21:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-25  7:59 Possible segfault introduced in commit.c Michael Mueller
2012-04-25 11:14 ` Jeff King
2012-04-25 20:22   ` René Scharfe
2012-04-25 20:35     ` [PATCH 1/3] sequencer: export commit_list_append() René Scharfe
2012-04-25 22:03       ` Junio C Hamano
2012-04-30 21:07         ` René Scharfe
2012-04-25 20:35     ` [PATCH 2/3] revision: append to list instead of insert and reverse René Scharfe
2012-04-25 20:35     ` [PATCH 3/3] commit: remove commit_list_reverse() René Scharfe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).