[compiler-rt] 4b10d1f - [compiler-rt] Fixing UB on Windows for trampoline allocations (#85639)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 06:16:22 PDT 2024


Author: Zack Johnson
Date: 2024-03-19T15:16:18+02:00
New Revision: 4b10d1fdd31f46a9cdf3e7a196f9934d766a922f

URL: https://github.com/llvm/llvm-project/commit/4b10d1fdd31f46a9cdf3e7a196f9934d766a922f
DIFF: https://github.com/llvm/llvm-project/commit/4b10d1fdd31f46a9cdf3e7a196f9934d766a922f.diff

LOG: [compiler-rt] Fixing UB on Windows for trampoline allocations (#85639)

Fixing the type of the constant to avoid undefined behavior with respect
to overflow.

Added: 
    

Modified: 
    compiler-rt/lib/interception/interception_win.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/interception/interception_win.cpp b/compiler-rt/lib/interception/interception_win.cpp
index 1829358705fe82..a04175ba1e4b56 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
+UNUSED static const uptr kTrampolineScanLimitRange = 1ull << 31;  // 2 gig
 static const int kMaxTrampolineRegion = 1024;
 static TrampolineMemoryRegion TrampolineRegions[kMaxTrampolineRegion];
 


        


More information about the llvm-commits mailing list