[libc-commits] [libc] 7c01791 - [libc][Obvious] Fix except flags reading overflow detected by asan.
Siva Chandra Reddy via libc-commits
libc-commits at lists.llvm.org
Sat Mar 13 16:31:27 PST 2021
Author: Siva Chandra Reddy
Date: 2021-03-13T16:30:33-08:00
New Revision: 7c0179129fa93afa6bd893c51314820f05355b87
URL: https://github.com/llvm/llvm-project/commit/7c0179129fa93afa6bd893c51314820f05355b87
DIFF: https://github.com/llvm/llvm-project/commit/7c0179129fa93afa6bd893c51314820f05355b87.diff
LOG: [libc][Obvious] Fix except flags reading overflow detected by asan.
Added:
Modified:
libc/src/fenv/fesetexceptflag.cpp
Removed:
################################################################################
diff --git a/libc/src/fenv/fesetexceptflag.cpp b/libc/src/fenv/fesetexceptflag.cpp
index 8d44a0447f70..1968ebea5a60 100644
--- a/libc/src/fenv/fesetexceptflag.cpp
+++ b/libc/src/fenv/fesetexceptflag.cpp
@@ -20,7 +20,7 @@ LLVM_LIBC_FUNCTION(int, fesetexceptflag,
// can fit in int type.
static_assert(sizeof(int) >= sizeof(fexcept_t),
"fexcept_t value cannot fit in an int value.");
- int excepts_to_set = *reinterpret_cast<const int *>(flagp) & excepts;
+ int excepts_to_set = static_cast<const int>(*flagp) & excepts;
return fputil::setExcept(excepts_to_set);
}
More information about the libc-commits
mailing list