git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] tag: avoid NULL pointer arithmetic

From
Jeff King <peff@peff.net>
Date
Oct 2, 2017, 19:23 UTC
Message-ID
<20171002192327.xyynkh47r2kgir7f@sigill.intra.peff.net>
In-Reply-To
<32a8b949-638a-1784-7fba-948ae32206fc@web.de>
On Mon, Oct 02, 2017 at 03:06:57PM +0200, René Scharfe wrote:
Show 12 quoted lines
> >> 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
Previous: René ScharfeNext: SZEDER Gábor
Message 5 of 13 in “tag: avoid NULL pointer arithmetic”
  1. tag: avoid NULL pointer arithmeticRené Scharfe, Oct 1, 2017
  2. Junio C HamanoOct 2, 2017
  3. Jeff KingOct 2, 2017
  4. René ScharfeOct 2, 2017
  5. Jeff KingOct 2, 2017
  6. SZEDER GáborOct 3, 2017
  7. René ScharfeOct 3, 2017
  8. fsck: check results of lookup_blob() and lookup_tree() for NULLRené Scharfe, Oct 3, 2017
  9. Junio C HamanoOct 4, 2017
  10. René ScharfeOct 5, 2017
  11. fsck: handle NULL return of lookup_blob() and lookup_tree()René Scharfe, Oct 5, 2017
  12. Junio C HamanoOct 6, 2017
  13. René ScharfeOct 6, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.