================
@@ -220,17 +220,18 @@ bool ObjectContainerMachOFileset::ParseHeader() {
 }
 
 size_t ObjectContainerMachOFileset::GetModuleSpecifications(
-    const lldb_private::FileSpec &file, lldb::DataBufferSP &data_sp,
+    const lldb_private::FileSpec &file, lldb::DataExtractorSP &extractor_sp,
     lldb::offset_t data_offset, lldb::offset_t file_offset,
     lldb::offset_t file_size, lldb_private::ModuleSpecList &specs) {
   const size_t initial_count = specs.GetSize();
+  if (!extractor_sp)
+    return initial_count;
 
-  DataExtractor extractor;
-  extractor.SetData(data_sp, data_offset, data_sp->GetByteSize());
-
-  if (MagicBytesMatch(extractor)) {
+  DataExtractorSP data_extractor_sp = extractor_sp->GetSubsetExtractorSP(
+      data_offset, extractor_sp->GetByteSize());
+  if (MagicBytesMatch(*data_extractor_sp)) {
----------------
JDevlieghere wrote:

Given that these offsets are "user controlled", we should be resilient and 
check the pointer so we don't crash.

https://github.com/llvm/llvm-project/pull/178347
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to