[Lldb-commits] [lldb] r157487 - /lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Greg Clayton
gclayton at apple.com
Fri May 25 11:09:55 PDT 2012
Author: gclayton
Date: Fri May 25 13:09:55 2012
New Revision: 157487
URL: http://llvm.org/viewvc/llvm-project?rev=157487&view=rev
Log:
<rdar://problem/11535465>
LC_ENCRYPTION_INFO with "cryptid == 0" is not actually encrypted and LLDB fails to read memory from file.
Modified:
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=157487&r1=157486&r2=157487&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Fri May 25 13:09:55 2012
@@ -751,7 +751,6 @@
{
lldb::user_id_t segID = 0;
lldb::user_id_t sectID = 0;
- struct segment_command_64 load_cmd;
uint32_t offset = MachHeaderSizeFromMagic(m_header.magic);
uint32_t i;
const bool is_core = GetType() == eTypeCoreFile;
@@ -760,24 +759,32 @@
// First look up any LC_ENCRYPTION_INFO load commands
typedef RangeArray<uint32_t, uint32_t, 8> EncryptedFileRanges;
EncryptedFileRanges encrypted_file_ranges;
+ encryption_info_command encryption_cmd;
for (i=0; i<m_header.ncmds; ++i)
{
const uint32_t load_cmd_offset = offset;
- if (m_data.GetU32(&offset, &load_cmd, 2) == NULL)
+ if (m_data.GetU32(&offset, &encryption_cmd, 2) == NULL)
break;
- if (load_cmd.cmd == LoadCommandEncryptionInfo)
+ if (encryption_cmd.cmd == LoadCommandEncryptionInfo)
{
- EncryptedFileRanges::Entry entry;
- entry.SetRangeBase(m_data.GetU32(&offset));
- entry.SetByteSize(m_data.GetU32(&offset));
- encrypted_file_ranges.Append(entry);
+ if (m_data.GetU32(&offset, &encryption_cmd.cryptoff, 3))
+ {
+ if (encryption_cmd.cryptid != 0)
+ {
+ EncryptedFileRanges::Entry entry;
+ entry.SetRangeBase(encryption_cmd.cryptoff);
+ entry.SetByteSize(encryption_cmd.cryptsize);
+ encrypted_file_ranges.Append(entry);
+ }
+ }
}
- offset = load_cmd_offset + load_cmd.cmdsize;
+ offset = load_cmd_offset + encryption_cmd.cmdsize;
}
offset = MachHeaderSizeFromMagic(m_header.magic);
+ struct segment_command_64 load_cmd;
for (i=0; i<m_header.ncmds; ++i)
{
const uint32_t load_cmd_offset = offset;
More information about the lldb-commits
mailing list