[Lldb-commits] [PATCH] D61218: Fix a stack-smasher in PlatformMacOSX::GetSDKDirectory()
Adrian Prantl via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 26 17:10:51 PDT 2019
aprantl created this revision.
aprantl added reviewers: jingham, jasonmolenda.
Herald added a project: LLDB.
GetSDKVersion expects the number of version fields not their byte size and will happily overwrite later contents of the stack.
I just found this by accident while stepping through the function and noticing that the backtrace disappears halfway through the function.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D61218
Files:
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
Index: lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
===================================================================
--- lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -164,7 +164,7 @@
std::string default_xcode_sdk;
FileSpec fspec;
uint32_t versions[2];
- if (objfile->GetSDKVersion(versions, sizeof(versions))) {
+ if (objfile->GetSDKVersion(versions, 2)) {
fspec = HostInfo::GetShlibDir();
if (fspec) {
std::string path;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61218.196931.patch
Type: text/x-patch
Size: 566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190427/1e13f5c5/attachment-0001.bin>
More information about the lldb-commits
mailing list