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

Marco Elver via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 18 01:42:14 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)) {
----------------
melver wrote:

> 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?

We don't know.

But it's clear currently an invariant here is `size != 0`, so why not add a DCHECK and catch if that assumption changes in future?

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


More information about the llvm-commits mailing list