Re: [PATCH] tag: avoid NULL pointer arithmetic
From: Jeff King <hidden>
Date: 2017-10-02 19:23:34
On Mon, Oct 02, 2017 at 03:06:57PM +0200, René Scharfe wrote:
quoted
quoted
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