git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Pieter de Bie <pdebie@ai.rug.nl>
Cc: Git Mailinglist <git@vger.kernel.org>
Subject: Re: Git's static analysis
Date: Thu, 05 Feb 2009 17:19:15 -0800	[thread overview]
Message-ID: <7v63jo9xbg.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1233870004-63540-1-git-send-email-pdebie@ai.rug.nl> (Pieter de Bie's message of "Thu, 5 Feb 2009 21:40:04 +0000")

Pieter de Bie <pdebie@ai.rug.nl> writes:

> I played around a bit with the 'Clang' static analyser, and tried to run git's
> source code through it. It comes up with a few possible errors, so I thought
> you might find it interesting. I took a quick glance, and it also seems to
> have a few false positives, but it might still be worth to take a look.
>
> The results can be found here:
>
> 	http://frim.frim.nl/git-analyse/

Hmm, I took a quick look at a few, and they looked nonsense, but perhaps I
am misreading things.

For example:

    http://frim.frim.nl/git-analyse/report-uxXiUR.html#EndPath

I am assuming that we follow the control flow of the labelled comments, so
I followed along from [1] to [7] and then saw these:

    [8] loop condition is false, execution continues on line 1492
    1483:   for (i = 0; i < array->nr; i++) {
                ...
            }

    [9] taking false branch
    1492:   if (array->nr <= i)
                return NULL;

    [10] dereference of null pointer.
    1495:   c->object.flags |= ...

The thing is, if [8] exits, "i < array->nr" is not true anymore, and there
is no way you can take false branch of  "if (array->nr <= i)" in the
immediately next step [9]. and reach point [10].

So it is either that the tool does not know how "for" and "if" statement
works in C language, or I am completely misunderstanding what the in-line
comments are trying to tell me.

  reply	other threads:[~2009-02-06  1:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-05 21:40 Git's static analysis Pieter de Bie
2009-02-06  1:19 ` Junio C Hamano [this message]
2009-02-06  6:11   ` Robin Rosenberg

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=7v63jo9xbg.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=pdebie@ai.rug.nl \
    /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;
as well as URLs for NNTP newsgroup(s).