mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Add CV_DISABLE_UBSAN to disable undefined behavior sanitizer
Also fix code here and there that triggered the fuzzer.
This commit is contained in:
@@ -684,7 +684,7 @@ __CV_ENUM_FLAGS_BITWISE_XOR_EQ (EnumType, EnumType)
|
||||
#endif
|
||||
|
||||
/****************************************************************************************\
|
||||
* Thread sanitizer *
|
||||
* Sanitizers *
|
||||
\****************************************************************************************/
|
||||
#ifndef CV_THREAD_SANITIZER
|
||||
# if defined(__has_feature)
|
||||
@@ -694,6 +694,12 @@ __CV_ENUM_FLAGS_BITWISE_XOR_EQ (EnumType, EnumType)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#define CV_DISABLE_UBSAN __attribute__((no_sanitize("undefined")))
|
||||
#else
|
||||
#define CV_DISABLE_UBSAN
|
||||
#endif
|
||||
|
||||
/****************************************************************************************\
|
||||
* exchange-add operation for atomic operations on reference counters *
|
||||
\****************************************************************************************/
|
||||
|
||||
@@ -361,6 +361,7 @@ CV_INLINE int cvRound( int value )
|
||||
}
|
||||
|
||||
/** @overload */
|
||||
CV_DISABLE_UBSAN
|
||||
CV_INLINE int cvFloor( float value )
|
||||
{
|
||||
#if defined CV__FASTMATH_ENABLE_GCC_MATH_BUILTINS || \
|
||||
|
||||
Reference in New Issue
Block a user