[PATCH] D17608: [sanitizer] Use res instead of len as a third parameter in COMMON_INTERCEPTOR_WRITE_RANGE in recv and recvfrom interceptors.

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 09:12:25 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL261898: [sanitizer] Fix third parameter in COMMON_INTERCEPTOR_WRITE_RANGE in recv and… (authored by chefmax).

Changed prior to commit:
  http://reviews.llvm.org/D17608?vs=49059&id=49079#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17608

Files:
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
  compiler-rt/trunk/test/asan/TestCases/Linux/recvfrom.cc

Index: compiler-rt/trunk/test/asan/TestCases/Linux/recvfrom.cc
===================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/recvfrom.cc
+++ compiler-rt/trunk/test/asan/TestCases/Linux/recvfrom.cc
@@ -33,7 +33,7 @@
     fprintf(stderr, "ERROR on binding\n");
 
   recvfrom(sockfd, buf, kBufSize, 0, NULL, NULL); // BOOM
-  // CHECK: {{WRITE of size 10 at 0x.* thread T1}}
+  // CHECK: {{WRITE of size 9 at 0x.* thread T1}}
   // CHECK: {{    #1 0x.* in server_thread_udp.*recvfrom.cc:}}[[@LINE-2]]
   // CHECK: {{Address 0x.* is located in stack of thread T1 at offset}}
   // CHECK-NEXT: in{{.*}}server_thread_udp{{.*}}recvfrom.cc
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -5340,7 +5340,7 @@
   COMMON_INTERCEPTOR_FD_ACCESS(ctx, fd);
   SSIZE_T res = REAL(recv)(fd, buf, len, flags);
   if (res > 0) {
-    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, len);
+    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, res);
   }
   if (res >= 0 && fd >= 0) COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
   return res;
@@ -5356,7 +5356,7 @@
   if (srcaddr) srcaddr_sz = *addrlen;
   SSIZE_T res = REAL(recvfrom)(fd, buf, len, flags, srcaddr, addrlen);
   if (res > 0) {
-    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, len);
+    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, res);
     if (srcaddr)
       COMMON_INTERCEPTOR_INITIALIZE_RANGE(srcaddr,
                                           Min((SIZE_T)*addrlen, srcaddr_sz));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17608.49079.patch
Type: text/x-patch
Size: 1716 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160225/0aa44401/attachment.bin>


More information about the llvm-commits mailing list