Skip to content

Commit 85284e7

Browse files
prevent crash on big keys (probably don't upstream)
1 parent 7b044e9 commit 85284e7

File tree

2 files changed

+1
-30
lines changed

2 files changed

+1
-30
lines changed

sdk/lib/cmlib/cmlib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ extern ULONG CmlibTraceLevel;
384384
do { if (CmpIsKeyValueBig(h,s)) DbgPrint("Big keys aren't supported!\n"); } while (0)
385385
#else
386386
#define ASSERT_VALUE_BIG(h, s) \
387-
ASSERTMSG("Big keys not supported!\n", !CmpIsKeyValueBig(h, s));
387+
//ASSERTMSG("Big keys not supported!\n", !CmpIsKeyValueBig(h, s));
388388
#endif
389389

390390
//

sdk/tools/pe2macho/pe2macho.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,11 @@ CreateMachOHeaderFromPeHeader(PIMAGE_OPTIONAL_HEADER32 OptionalHeader, UINT32 Pe
6262
UINT32 MachoInfoSize;
6363
PMACHO_HEADER MachoHeader;
6464
PMACHO_SEGMENT_COMMAND MachoSegmentCommand;
65-
//PMACHO_SECTION MachoSection;
6665
PMACHO_THREAD_COMMAND_X86 MachoUnixThread;
6766
UINT32 SizeOfExecData;
6867

69-
// We only use a single segment with a single section, which doesn't impact runtime but does impact things like disassembling.
70-
// Disassembling should be done with the original PE file.
71-
7268
MachoInfoSize = sizeof(MACHO_HEADER)
7369
+ sizeof(MACHO_SEGMENT_COMMAND)
74-
//+ sizeof(MACHO_SECTION)
7570
+ sizeof(MACHO_THREAD_COMMAND_X86);
7671

7772
MachoHeader = malloc(MachoInfoSize);
@@ -118,30 +113,6 @@ CreateMachOHeaderFromPeHeader(PIMAGE_OPTIONAL_HEADER32 OptionalHeader, UINT32 Pe
118113
MachoSegmentCommand->NumberOfSections = 0;
119114
MachoSegmentCommand->Flags = 0;
120115

121-
/*
122-
// Fill out first and only section.
123-
MachoSection = (PMACHO_SECTION) (((PUCHAR) MachoSegmentCommand) + sizeof(MACHO_SEGMENT_COMMAND));
124-
125-
strcpy(MachoSection->SectionName, "__entry");
126-
strcpy(MachoSection->SegmentName, "__TEXT");
127-
128-
MachoSection->Address = OptionalHeader->ImageBase + OptionalHeader->AddressOfEntryPoint; // Entry address!!
129-
MachoSection->Size = SizeOfExecData - (OptionalHeader->AddressOfEntryPoint + OptionalHeader->SectionAlignment);
130-
MachoSection->Offset = OptionalHeader->AddressOfEntryPoint;
131-
132-
MachoSection->Alignment = __builtin_ctz(OptionalHeader->SectionAlignment);
133-
134-
MachoSection->RelocationOffset = 0; // no relocations here :D
135-
MachoSection->NumberOfRelocation = 0;
136-
137-
MachoSection->Flags = 0x80000400;
138-
139-
MachoSection->Reserved1 = 0;
140-
MachoSection->Reserved2 = 0;
141-
142-
// Fill out second load command.
143-
MachoUnixThread = (PMACHO_THREAD_COMMAND_X86) (((PUCHAR) MachoSection) + sizeof(MACHO_SECTION));
144-
*/
145116
MachoUnixThread = (PMACHO_THREAD_COMMAND_X86) (((PUCHAR) MachoSegmentCommand) + sizeof(MACHO_SEGMENT_COMMAND));
146117

147118
MachoUnixThread->Command = MACHO_LC_UNIXTHREAD;

0 commit comments

Comments
 (0)