[Lldb-commits] [PATCH] D57964: Fix potential UB when target_file directory is null
Stefan Gränitz via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 11 03:44:06 PST 2019
sgraenitz updated this revision to Diff 186224.
sgraenitz added a comment.
Polish && error out also on empty string
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57964/new/
https://reviews.llvm.org/D57964
Files:
source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===================================================================
--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -2780,6 +2780,11 @@
basename = pathname; // not a filename, probably a package of some sort,
// let it go through
} else if (is_directory(st) || is_regular_file(st)) {
+ if (target_file.GetDirectory().IsEmpty()) {
+ error.SetErrorString("invalid directory name");
+ return false;
+ }
+
std::string directory = target_file.GetDirectory().GetCString();
replace_all(directory, "\\", "\\\\");
replace_all(directory, "'", "\\'");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57964.186224.patch
Type: text/x-patch
Size: 800 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190211/27a310e1/attachment.bin>
More information about the lldb-commits
mailing list