[llvm-commits] [poolalloc] r134076 - /poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Wed Jun 29 09:53:51 PDT 2011


Author: aggarwa4
Date: Wed Jun 29 11:53:51 2011
New Revision: 134076

URL: http://llvm.org/viewvc/llvm-project?rev=134076&view=rev
Log:
Fix off by one error in strcat.
Fix error handling in readlink.
For accept, take the size from argument no. 3.

Modified:
    poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp

Modified: poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp?rev=134076&r1=134075&r2=134076&view=diff
==============================================================================
--- poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp (original)
+++ poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp Wed Jun 29 11:53:51 2011
@@ -81,8 +81,9 @@
   void trackgetpwuid(void *ptr, uint32_t tag) ;
   void trackgethostname(void *ptr, uint32_t tag) ;
   void trackgetaddrinfo(void *ptr, uint32_t tag) ;
-  void trackaccept(void *ptr, uint32_t tag) ;
+  void trackaccept(void *ptr, void *size,uint32_t tag) ;
   void trackpoll(void *ptr, uint64_t nfds, uint32_t tag) ;
+  void trackReadLink(void *ptr, int64_t val, uint32_t tag) ;
 }
 
 void trackInitInst(void *ptr, uint64_t size, uint32_t tag);
@@ -364,7 +365,7 @@
  * Initialize the metadata fr dst pointer of strcap
  */
 void trackStrcatInst(void *dst, void *src, uint32_t tag) {
-  uintptr_t dst_start = (uintptr_t)(dst) + strlen((const char *)dst) -1;
+  uintptr_t dst_start = (uintptr_t)(dst) + strlen((const char *)dst);
   copyTypeInfo((void*)dst_start, src, strlen((const char *)src)+1, tag);
 }
 
@@ -401,8 +402,9 @@
   trackInitInst(result, sizeof(struct addrinfo*), tag);
 }
 
-void trackaccept(void *ptr, uint32_t tag) {
-  trackInitInst(ptr, sizeof(struct sockaddr), tag);
+void trackaccept(void *ptr, void *size, uint32_t tag) {
+  int32_t bytes = *((int32_t*)size);
+  trackInitInst(ptr, (uint64_t)bytes, tag);
 }
 
 void trackpoll(void *ptr, uint64_t nfds, uint32_t tag) {
@@ -413,3 +415,8 @@
     i++;
   }
 }
+void trackReadLink(void *ptr, int64_t val, uint32_t tag) {
+  if(val == -1)
+    return;
+  trackInitInst(ptr, val, tag);
+}





More information about the llvm-commits mailing list