ElfLinker::init() zero length implies 0x4000 blank bytes

This commit is contained in:
jreiser@BitWagon.com
2016-09-05 20:36:07 -07:00
committed by Markus F.X.J. Oberhumer
parent 98b428a8be
commit 1197beaa13
+3 -1
View File
@@ -184,9 +184,10 @@ void ElfLinker::init(const void *pdata_v, int plen)
} }
input[inputlen] = 0; // NUL terminate input[inputlen] = 0; // NUL terminate
output = new upx_byte[inputlen]; output = new upx_byte[inputlen ? inputlen : 0x4000];
outputlen = 0; outputlen = 0;
if ((int)strlen("Sections:\n" "SYMBOL TABLE:\n" "RELOCATION RECORDS FOR ") < inputlen) {
int pos = find(input, inputlen, "Sections:\n", 10); int pos = find(input, inputlen, "Sections:\n", 10);
assert(pos != -1); assert(pos != -1);
char *psections = (char *) input + pos; char *psections = (char *) input + pos;
@@ -202,6 +203,7 @@ void ElfLinker::init(const void *pdata_v, int plen)
preprocessRelocations(prelocs, (char*) input + inputlen); preprocessRelocations(prelocs, (char*) input + inputlen);
addLoader("*UND*"); addLoader("*UND*");
} }
}
void ElfLinker::preprocessSections(char *start, char *end) void ElfLinker::preprocessSections(char *start, char *end)
{ {