git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] tag: avoid NULL pointer arithmetic
Date: Mon, 2 Oct 2017 15:23:27 -0400	[thread overview]
Message-ID: <20171002192327.xyynkh47r2kgir7f@sigill.intra.peff.net> (raw)
In-Reply-To: <32a8b949-638a-1784-7fba-948ae32206fc@web.de>

On Mon, Oct 02, 2017 at 03:06:57PM +0200, René Scharfe wrote:

> >> Avoid the ASan error by casting the results of the lookup functions to
> >> struct object pointers.  That works fine with NULL pointers as well.  We
> >> already rely on the object member being first in all object types in
> >> other places in the code.
> > 
> > Out of curiosity, did you have to do anything to coax this out of ASan
> > (e.g., a specific version)?  I've been running it pretty regularly and
> > didn't see this one (I did switch from clang to gcc a month or two ago,
> > but this code is pretty old, I think).
> 
> I did "make -j4 SANITIZE=undefined,address BLK_SHA1=1 test" with
> clang version 4.0.1-1 (tags/RELEASE_401/final), and t1450-fsck.sh failed.

Interesting. I can trigger it with the same setup, but not if:

  1. I use gcc instead of clang.

  2. If I only use one of UBSan and ASan. It's the combination that
     triggers it.

-Peff

  reply	other threads:[~2017-10-02 19:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-01 14:45 [PATCH] tag: avoid NULL pointer arithmetic René Scharfe
2017-10-02  4:13 ` Junio C Hamano
2017-10-02  5:08 ` Jeff King
2017-10-02 13:06   ` René Scharfe
2017-10-02 19:23     ` Jeff King [this message]
2017-10-03 10:22 ` SZEDER Gábor
2017-10-03 12:51   ` René Scharfe
2017-10-03 13:47     ` [PATCH] fsck: check results of lookup_blob() and lookup_tree() for NULL René Scharfe
2017-10-04  4:00       ` Junio C Hamano
2017-10-05 19:41         ` René Scharfe
2017-10-05 19:41       ` [PATCH v2] fsck: handle NULL return of lookup_blob() and lookup_tree() René Scharfe
2017-10-06  2:23         ` Junio C Hamano
2017-10-06 16:21           ` René Scharfe

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171002192327.xyynkh47r2kgir7f@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).