amccarth added a comment.

I'm growing more comfortable with these changes, but I'll defer to Zach.


================
Comment at: lldb/trunk/source/Host/common/FileSpec.cpp:242
@@ -221,1 +241,3 @@
+        path.push_back(0);
+        path.pop_back();
     }
----------------
I recognize that you're just repeating the pattern from above, but ...

This seems whacky and dangerous.  It appears the attempt is to put a null 
terminator on the end, but not count it in the length of the vector.  And I 
guess that we know it's safe here because path is an llvm::SmallVector, so the 
implementation details are known.  But, ugh.  If `path` were ever changed to 
std::vector, we'd no longer have assurance that the terminator remains after 
the pop.

================
Comment at: lldb/trunk/source/Host/windows/FileSystem.cpp:231
@@ -191,3 +230,3 @@
 
-    char buf[PATH_MAX];
+    wchar_t buf[PATH_MAX + 1];
     // Subtract 1 from the path length since this function does not add a null 
terminator.
----------------
I agree with Zach that a dynamic solution here is better.  It's already icky 
that we have a 32KB stack buffer here.  Turning it into a 64KB +1B stack buffer 
seem egregious.


http://reviews.llvm.org/D17107



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

Reply via email to