1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-21 19:33:03 +04:00

Merge pull request #28951 from vrabaud:ubsan

Add CV_DISABLE_UBSAN to disable undefined behavior sanitizer
This commit is contained in:
Alexander Smorkalov
2026-05-07 08:12:20 +03:00
committed by GitHub
4 changed files with 11 additions and 1 deletions
+7 -1
View File
@@ -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 || \
+1
View File
@@ -1494,6 +1494,7 @@ FillEdgeCollection( Mat& img, std::vector<PolyEdge>& edges, const void* color )
/* draws simple or filled circle */
CV_DISABLE_UBSAN
static void
Circle( Mat& img, Point center, int radius, const void* color, int fill )
{
+2
View File
@@ -2276,6 +2276,7 @@ void warpAffine(int src_type,
parallel_for_(range, invoker, dst.total()/(double)(1<<16));
}
CV_DISABLE_UBSAN
void warpAffineBlocklineNN(int *adelta, int *bdelta, short* xy, int X0, int Y0, int bw)
{
CALL_HAL(warpAffineBlocklineNN, cv_hal_warpAffineBlocklineNN, adelta, bdelta, xy, X0, Y0, bw);
@@ -2306,6 +2307,7 @@ void warpAffineBlocklineNN(int *adelta, int *bdelta, short* xy, int X0, int Y0,
}
}
CV_DISABLE_UBSAN
void warpAffineBlockline(int *adelta, int *bdelta, short* xy, short* alpha, int X0, int Y0, int bw)
{
CALL_HAL(warpAffineBlockline, cv_hal_warpAffineBlockline, adelta, bdelta, xy, alpha, X0, Y0, bw);