@@ -347,11 +347,33 @@ INTERCEPTOR(int, setvbuf, FILE *stream, char *buf, int mode, size_t size) {
347347 __rtsan_notify_intercepted_call (" setvbuf" );
348348 return REAL (setvbuf)(stream, buf, mode, size);
349349}
350+
351+ #if SANITIZER_LINUX
352+ INTERCEPTOR (void , setlinebuf, FILE *stream) {
353+ #else
354+ INTERCEPTOR (int , setlinebuf, FILE *stream) {
355+ #endif
356+ __rtsan_notify_intercepted_call (" setlinebuf" );
357+ return REAL (setlinebuf)(stream);
358+ }
359+
360+ #if SANITIZER_LINUX
361+ INTERCEPTOR (void , setbuffer, FILE *stream, char *buf, size_t size) {
362+ #else
363+ INTERCEPTOR (void , setbuffer, FILE *stream, char *buf, int size) {
364+ #endif
365+ __rtsan_notify_intercepted_call (" setbuffer" );
366+ return REAL (setbuffer)(stream, buf, size);
367+ }
350368#define RTSAN_MAYBE_INTERCEPT_SETBUF INTERCEPT_FUNCTION (setbuf)
351369#define RTSAN_MAYBE_INTERCEPT_SETVBUF INTERCEPT_FUNCTION (setvbuf)
370+ #define RTSAN_MAYBE_INTERCEPT_SETLINEBUF INTERCEPT_FUNCTION (setlinebuf)
371+ #define RTSAN_MAYBE_INTERCEPT_SETBUFFER INTERCEPT_FUNCTION (setbuffer)
352372#else
353373#define RTSAN_MAYBE_INTERCEPT_SETBUF
354374#define RTSAN_MAYBE_INTERCEPT_SETVBUF
375+ #define RTSAN_MAYBE_INTERCEPT_SETLINEBUF
376+ #define RTSAN_MAYBE_INTERCEPT_SETBUFFER
355377#endif
356378
357379INTERCEPTOR (int , puts, const char *s) {
@@ -1018,6 +1040,8 @@ void __rtsan::InitializeInterceptors() {
10181040 RTSAN_MAYBE_INTERCEPT_FMEMOPEN;
10191041 RTSAN_MAYBE_INTERCEPT_SETBUF;
10201042 RTSAN_MAYBE_INTERCEPT_SETVBUF;
1043+ RTSAN_MAYBE_INTERCEPT_SETLINEBUF;
1044+ RTSAN_MAYBE_INTERCEPT_SETBUFFER;
10211045 INTERCEPT_FUNCTION (lseek);
10221046 RTSAN_MAYBE_INTERCEPT_LSEEK64;
10231047 INTERCEPT_FUNCTION (dup);
0 commit comments