From bfc40b1a1a2c6149e2ebcdc47ffac7d018e2b78d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Endre=20F=C3=BCl=C3=B6p?= Date: Mon, 7 Mar 2022 14:53:26 +0100 Subject: [PATCH] [analyzer] Fix buildbot failure for D120369 Fix test case for GenericTaintChecker. Redefinition of types is a C11 feature, and it broke a buildbot. Commit amended: 4fd6c6e65ab59f82284d8272aa3bec8d5084511e. --- clang/test/Analysis/taint-generic.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/clang/test/Analysis/taint-generic.c b/clang/test/Analysis/taint-generic.c index 0fdd054..626e01e 100644 --- a/clang/test/Analysis/taint-generic.c +++ b/clang/test/Analysis/taint-generic.c @@ -105,6 +105,13 @@ void *malloc(size_t); void *calloc(size_t nmemb, size_t size); void bcopy(void *s1, void *s2, size_t n); +typedef size_t socklen_t; + +struct sockaddr { + unsigned short sa_family; + char sa_data[14]; +}; + #define BUFSIZE 10 int Buffer[BUFSIZE]; @@ -437,8 +444,6 @@ int testGethostname(char *name, size_t len) { return system(name); // expected-warning {{Untrusted data is passed to a system call}} } -struct sockaddr; -typedef size_t socklen_t; int getnameinfo(const struct sockaddr *restrict addr, socklen_t addrlen, char *restrict host, socklen_t hostlen, char *restrict serv, socklen_t servlen, int flags); @@ -506,13 +511,6 @@ void testRecv(int *buf, size_t len, int flags) { clang_analyzer_isTainted_int(read); // expected-warning {{YES}} } -typedef size_t socklen_t; - -struct sockaddr { - unsigned short sa_family; - char sa_data[14]; -}; - ssize_t recvfrom(int sockfd, void *restrict buf, size_t len, int flags, struct sockaddr *restrict src_addr, socklen_t *restrict addrlen); -- 2.7.4