tberghammer added a subscriber: tberghammer.
tberghammer requested changes to this revision.
tberghammer added a reviewer: tberghammer.
This revision now requires changes to proceed.

================
Comment at: source/Plugins/Process/Linux/NativeProcessLinux.cpp:2549-2550
@@ -2548,6 +2548,4 @@
 
         // Copy the data into our buffer
-        for (unsigned i = 0; i < remainder; ++i)
-            dst[i] = ((data >> i*8) & 0xFF);
-
+        *((long*)(dst)) = data;
         if (log && ProcessPOSIXLog::AtTopNestLevel() &&
----------------
This will be a buffer overrun if "size % sizeof(long) != 0" (and also violating 
strict aliasing). I suggest to use memcpy instead what fixes both of these 
issue.

================
Comment at: source/Plugins/Process/Linux/NativeProcessLinux.cpp:2601
@@ -2602,4 +2600,3 @@
             unsigned long data = 0;
-            for (unsigned i = 0; i < k_ptrace_word_size; ++i)
-                data |= (unsigned long)src[i] << i*8;
+            data = *((unsigned long*)src);
 
----------------
Same here


Repository:
  rL LLVM

http://reviews.llvm.org/D15738



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to