[compiler-rt] [TSan] Make Shadow/Meta region inclusive-exclusive (PR #144647)

Kunqiu Chen via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 18 01:33:23 PDT 2025


================
@@ -675,7 +675,7 @@ void MemoryAccessRangeT(ThreadState* thr, uptr pc, uptr addr, uptr size) {
     Printf("Access to non app mem start: %p\n", (void*)addr);
     DCHECK(IsAppMem(addr));
   }
-  if (!IsAppMem(addr + size - 1)) {
+  if (size > 0 && !IsAppMem(addr + size - 1)) {
----------------
Camsyn wrote:

I understand this. 
But `MemoryAccessRangeT` did not guarantee `size != 0` in its context -- is it possible for `MemoryAccessRangeT` to be called in the future without checking for size == 0? 

It just so happens that these checks are wrapped in `SANITIZER_DEBUG` macro, so I think adding this check is better to adding an assertion `DCHECK(size != 0)`.

https://github.com/llvm/llvm-project/pull/144647


More information about the llvm-commits mailing list