[Lldb-commits] [PATCH] D17107: [lldb] Unicode support on Win32
Adrian McCarthy via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 25 16:55:06 PST 2016
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
More information about the lldb-commits
mailing list