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;


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;
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to