[compiler-rt] Fixing UB on Windows for trampoline allocations (PR #85639)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 18 06:49:57 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Zack Johnson (zacklj89)
<details>
<summary>Changes</summary>
This is _actually_ used on Windows, so removing `UNUSED` as well as fixing the type of the constant to avoid undefined behavior with respect to overflow.
---
Full diff: https://github.com/llvm/llvm-project/pull/85639.diff
1 Files Affected:
- (modified) compiler-rt/lib/interception/interception_win.cpp (+1-1)
``````````diff
diff --git a/compiler-rt/lib/interception/interception_win.cpp b/compiler-rt/lib/interception/interception_win.cpp
index 1829358705fe82..3602b24401a3a1 100644
--- a/compiler-rt/lib/interception/interception_win.cpp
+++ b/compiler-rt/lib/interception/interception_win.cpp
@@ -339,7 +339,7 @@ struct TrampolineMemoryRegion {
uptr max_size;
};
-UNUSED static const uptr kTrampolineScanLimitRange = 1 << 31; // 2 gig
+static const uptr kTrampolineScanLimitRange = 1ull << 31; // 2 gig
static const int kMaxTrampolineRegion = 1024;
static TrampolineMemoryRegion TrampolineRegions[kMaxTrampolineRegion];
``````````
</details>
https://github.com/llvm/llvm-project/pull/85639
More information about the llvm-commits
mailing list