@@ -480,7 +480,7 @@ INTERCEPTOR(char*, textdomain, const char *domainname) {
480480#define INIT_TEXTDOMAIN
481481#endif
482482
483- #if SANITIZER_INTERCEPT_STRCMP || SANITIZER_INTERCEPT_MEMCMP
483+ #if SANITIZER_INTERCEPT_MEMCMP
484484static inline int CharCmpX (unsigned char c1, unsigned char c2) {
485485 return (c1 == c2) ? 0 : (c1 < c2) ? -1 : 1 ;
486486}
@@ -953,7 +953,7 @@ INTERCEPTOR(double, frexp, double x, int *exp) {
953953#define INIT_FREXP
954954#endif // SANITIZER_INTERCEPT_FREXP
955955
956- #if SANITIZER_INTERCEPT_FREXPF_FREXPL
956+ #if SANITIZER_INTERCEPT_FREXPF
957957INTERCEPTOR (float , frexpf, float x, int *exp) {
958958 void *ctx;
959959 COMMON_INTERCEPTOR_ENTER (ctx, frexpf, x, exp);
@@ -963,6 +963,12 @@ INTERCEPTOR(float, frexpf, float x, int *exp) {
963963 return res;
964964}
965965
966+ # define INIT_FREXPF COMMON_INTERCEPT_FUNCTION (frexpf);
967+ #else
968+ # define INIT_FREXPF
969+ #endif
970+
971+ #if SANITIZER_INTERCEPT_FREXPL
966972INTERCEPTOR (long double , frexpl, long double x, int *exp) {
967973 void *ctx;
968974 COMMON_INTERCEPTOR_ENTER (ctx, frexpl, x, exp);
@@ -972,12 +978,10 @@ INTERCEPTOR(long double, frexpl, long double x, int *exp) {
972978 return res;
973979}
974980
975- #define INIT_FREXPF_FREXPL \
976- COMMON_INTERCEPT_FUNCTION (frexpf); \
977- COMMON_INTERCEPT_FUNCTION_LDBL (frexpl)
981+ # define INIT_FREXPL COMMON_INTERCEPT_FUNCTION_LDBL (frexpl)
978982#else
979- #define INIT_FREXPF_FREXPL
980- #endif // SANITIZER_INTERCEPT_FREXPF_FREXPL
983+ # define INIT_FREXPL
984+ #endif
981985
982986#if SI_POSIX
983987static void write_iovec (void *ctx, struct __sanitizer_iovec *iovec,
@@ -1346,7 +1350,8 @@ INTERCEPTOR(unsigned long, time, unsigned long *t) {
13461350#if SANITIZER_INTERCEPT_LOCALTIME_AND_FRIENDS
13471351static void unpoison_tm (void *ctx, __sanitizer_tm *tm) {
13481352 COMMON_INTERCEPTOR_WRITE_RANGE (ctx, tm, sizeof (*tm));
1349- #if !SANITIZER_SOLARIS
1353+ // AIX tm struct does not have tm_zone field.
1354+ # if !SANITIZER_SOLARIS && !SANITIZER_AIX
13501355 if (tm->tm_zone ) {
13511356 // Can not use COMMON_INTERCEPTOR_WRITE_RANGE here, because tm->tm_zone
13521357 // can point to shared memory and tsan would report a data race.
@@ -1731,10 +1736,12 @@ INTERCEPTOR(int, __vsprintf_chk, char *str, int flag, SIZE_T size_to,
17311736VSPRINTF_INTERCEPTOR_IMPL (vsprintf, str, format, ap)
17321737#endif
17331738
1739+ # if SANITIZER_INTERCEPT_VASPRINTF
17341740INTERCEPTOR (int , vasprintf, char **strp, const char *format, va_list ap)
17351741VASPRINTF_INTERCEPTOR_IMPL (vasprintf, strp, format, ap)
1742+ # endif
17361743
1737- #if SANITIZER_INTERCEPT_ISOC99_PRINTF
1744+ # if SANITIZER_INTERCEPT_ISOC99_PRINTF
17381745INTERCEPTOR (int , __isoc99_vprintf, const char *format, va_list ap)
17391746VPRINTF_INTERCEPTOR_IMPL (__isoc99_vprintf, format, ap)
17401747
@@ -1783,10 +1790,12 @@ INTERCEPTOR(int, __snprintf_chk, char *str, SIZE_T size, int flag,
17831790FORMAT_INTERCEPTOR_IMPL (__snprintf_chk, vsnprintf, str, size, format)
17841791#endif
17851792
1793+ # if SANITIZER_INTERCEPT_ASPRINTF
17861794INTERCEPTOR (int , asprintf, char **strp, const char *format, ...)
17871795FORMAT_INTERCEPTOR_IMPL (asprintf, vasprintf, strp, format)
1796+ # endif
17881797
1789- #if SANITIZER_INTERCEPT_ISOC99_PRINTF
1798+ # if SANITIZER_INTERCEPT_ISOC99_PRINTF
17901799INTERCEPTOR (int , __isoc99_printf, const char *format, ...)
17911800FORMAT_INTERCEPTOR_IMPL (__isoc99_printf, __isoc99_vprintf, format)
17921801
@@ -1807,17 +1816,29 @@ FORMAT_INTERCEPTOR_IMPL(__isoc99_snprintf, __isoc99_vsnprintf, str, size,
18071816#endif // SANITIZER_INTERCEPT_PRINTF
18081817
18091818#if SANITIZER_INTERCEPT_PRINTF
1810- #define INIT_PRINTF \
1811- COMMON_INTERCEPT_FUNCTION_LDBL (printf); \
1812- COMMON_INTERCEPT_FUNCTION_LDBL (sprintf); \
1813- COMMON_INTERCEPT_FUNCTION_LDBL (snprintf); \
1814- COMMON_INTERCEPT_FUNCTION_LDBL (asprintf); \
1815- COMMON_INTERCEPT_FUNCTION_LDBL (fprintf); \
1816- COMMON_INTERCEPT_FUNCTION_LDBL (vprintf); \
1817- COMMON_INTERCEPT_FUNCTION_LDBL (vsprintf); \
1818- COMMON_INTERCEPT_FUNCTION_LDBL (vsnprintf); \
1819- COMMON_INTERCEPT_FUNCTION_LDBL (vasprintf); \
1820- COMMON_INTERCEPT_FUNCTION_LDBL (vfprintf);
1819+ # if SANITIZER_AIX
1820+ # define INIT_PRINTF \
1821+ COMMON_INTERCEPT_FUNCTION_LDBL (printf); \
1822+ COMMON_INTERCEPT_FUNCTION_LDBL (sprintf); \
1823+ COMMON_INTERCEPT_FUNCTION_LDBL (snprintf); \
1824+ COMMON_INTERCEPT_FUNCTION_LDBL (fprintf); \
1825+ COMMON_INTERCEPT_FUNCTION_LDBL (vprintf); \
1826+ COMMON_INTERCEPT_FUNCTION_LDBL (vsprintf); \
1827+ COMMON_INTERCEPT_FUNCTION_LDBL (vsnprintf); \
1828+ COMMON_INTERCEPT_FUNCTION_LDBL (vfprintf);
1829+ # else
1830+ # define INIT_PRINTF \
1831+ COMMON_INTERCEPT_FUNCTION_LDBL (printf); \
1832+ COMMON_INTERCEPT_FUNCTION_LDBL (sprintf); \
1833+ COMMON_INTERCEPT_FUNCTION_LDBL (snprintf); \
1834+ COMMON_INTERCEPT_FUNCTION_LDBL (fprintf); \
1835+ COMMON_INTERCEPT_FUNCTION_LDBL (vprintf); \
1836+ COMMON_INTERCEPT_FUNCTION_LDBL (vsprintf); \
1837+ COMMON_INTERCEPT_FUNCTION_LDBL (vsnprintf); \
1838+ COMMON_INTERCEPT_FUNCTION_LDBL (asprintf); \
1839+ COMMON_INTERCEPT_FUNCTION_LDBL (vasprintf); \
1840+ COMMON_INTERCEPT_FUNCTION_LDBL (vfprintf);
1841+ # endif
18211842#else
18221843#define INIT_PRINTF
18231844#endif
@@ -3917,7 +3938,11 @@ INTERCEPTOR(SIZE_T, wcrtomb, char *dest, wchar_t src, void *ps) {
39173938 if (res != ((SIZE_T)-1 )) {
39183939 CHECK_LE (res, sizeof (local_dest));
39193940 COMMON_INTERCEPTOR_WRITE_RANGE (ctx, dest, res);
3941+ # if !SANITIZER_AIX
39203942 REAL (memcpy)(dest, local_dest, res);
3943+ # else
3944+ internal_memcpy (dest, local_dest, res);
3945+ # endif
39213946 }
39223947 return res;
39233948}
@@ -3939,7 +3964,11 @@ INTERCEPTOR(int, wctomb, char *dest, wchar_t src) {
39393964 if (res != -1 ) {
39403965 CHECK_LE (res, sizeof (local_dest));
39413966 COMMON_INTERCEPTOR_WRITE_RANGE (ctx, dest, res);
3967+ # if !SANITIZER_AIX
39423968 REAL (memcpy)(dest, local_dest, res);
3969+ # else
3970+ internal_memcpy (dest, local_dest, res);
3971+ # endif
39433972 }
39443973 return res;
39453974}
@@ -10411,7 +10440,8 @@ static void InitializeCommonInterceptors() {
1041110440 INIT_ISOC99_PRINTF;
1041210441 INIT_SETPROCTITLE;
1041310442 INIT_FREXP;
10414- INIT_FREXPF_FREXPL;
10443+ INIT_FREXPF;
10444+ INIT_FREXPL;
1041510445 INIT_GETPWNAM_AND_FRIENDS;
1041610446 INIT_GETPWNAM_R_AND_FRIENDS;
1041710447 INIT_GETPWENT;
0 commit comments