@@ -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,8 +1736,10 @@ 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
17371744#if SANITIZER_INTERCEPT_ISOC99_PRINTF
17381745INTERCEPTOR (int , __isoc99_vprintf, const char *format, va_list ap)
@@ -1783,8 +1790,10 @@ 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
17891798#if SANITIZER_INTERCEPT_ISOC99_PRINTF
17901799INTERCEPTOR (int , __isoc99_printf, const char *format, ...)
@@ -1807,17 +1816,29 @@ FORMAT_INTERCEPTOR_IMPL(__isoc99_snprintf, __isoc99_vsnprintf, str, size,
18071816#endif // SANITIZER_INTERCEPT_PRINTF
18081817
18091818#if SANITIZER_INTERCEPT_PRINTF
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
18101830#define INIT_PRINTF \
18111831 COMMON_INTERCEPT_FUNCTION_LDBL (printf); \
18121832 COMMON_INTERCEPT_FUNCTION_LDBL (sprintf); \
18131833 COMMON_INTERCEPT_FUNCTION_LDBL (snprintf); \
1814- COMMON_INTERCEPT_FUNCTION_LDBL (asprintf); \
18151834 COMMON_INTERCEPT_FUNCTION_LDBL (fprintf); \
18161835 COMMON_INTERCEPT_FUNCTION_LDBL (vprintf); \
18171836 COMMON_INTERCEPT_FUNCTION_LDBL (vsprintf); \
18181837 COMMON_INTERCEPT_FUNCTION_LDBL (vsnprintf); \
1838+ COMMON_INTERCEPT_FUNCTION_LDBL (asprintf); \
18191839 COMMON_INTERCEPT_FUNCTION_LDBL (vasprintf); \
18201840 COMMON_INTERCEPT_FUNCTION_LDBL (vfprintf);
1841+ #endif
18211842#else
18221843#define INIT_PRINTF
18231844#endif
@@ -3901,7 +3922,10 @@ INTERCEPTOR(SIZE_T, wcrtomb, char *dest, wchar_t src, void *ps) {
39013922 if (res != ((SIZE_T)-1 )) {
39023923 CHECK_LE (res, sizeof (local_dest));
39033924 COMMON_INTERCEPTOR_WRITE_RANGE (ctx, dest, res);
3904- REAL (memcpy)(dest, local_dest, res);
3925+ if (!SANITIZER_AIX)
3926+ REAL (memcpy)(dest, local_dest, res);
3927+ else
3928+ internal_memcpy (dest, local_dest, res);
39053929 }
39063930 return res;
39073931}
@@ -3923,7 +3947,10 @@ INTERCEPTOR(int, wctomb, char *dest, wchar_t src) {
39233947 if (res != -1 ) {
39243948 CHECK_LE (res, sizeof (local_dest));
39253949 COMMON_INTERCEPTOR_WRITE_RANGE (ctx, dest, res);
3926- REAL (memcpy)(dest, local_dest, res);
3950+ if (!SANITIZER_AIX)
3951+ REAL (memcpy)(dest, local_dest, res);
3952+ else
3953+ internal_memcpy (dest, local_dest, res);
39273954 }
39283955 return res;
39293956}
@@ -10329,7 +10356,8 @@ static void InitializeCommonInterceptors() {
1032910356 INIT_PRINTF_L;
1033010357 INIT_ISOC99_PRINTF;
1033110358 INIT_FREXP;
10332- INIT_FREXPF_FREXPL;
10359+ INIT_FREXPF;
10360+ INIT_FREXPL;
1033310361 INIT_GETPWNAM_AND_FRIENDS;
1033410362 INIT_GETPWNAM_R_AND_FRIENDS;
1033510363 INIT_GETPWENT;
0 commit comments