added some input validity checks (for sf.net bug 3122661)
This commit is contained in:
parent
9a67ce5968
commit
1e3555a6b7
@ -244,7 +244,7 @@ unsigned PackArmPe::processImports() // pass 1
|
||||
|
||||
soimport += strlen(dlls[ic].name) + 1 + 4;
|
||||
|
||||
for (LE32 *tarr = dlls[ic].lookupt; *tarr; tarr++)
|
||||
for (IPTR_I(LE32, tarr, dlls[ic].lookupt); *tarr; tarr += 1)
|
||||
{
|
||||
if (*tarr & 0x80000000)
|
||||
{
|
||||
@ -256,10 +256,12 @@ unsigned PackArmPe::processImports() // pass 1
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned len = strlen(ibuf + *tarr + 2);
|
||||
{
|
||||
IPTR_I(const upx_byte, n, ibuf + *tarr + 2);
|
||||
unsigned len = strlen(n);
|
||||
soimport += len + 1;
|
||||
if (dlls[ic].shname == NULL || len < strlen (dlls[ic].shname))
|
||||
dlls[ic].shname = ibuf + *tarr + 2;
|
||||
dlls[ic].shname = n;
|
||||
}
|
||||
soimport++; // separator
|
||||
}
|
||||
|
||||
@ -407,7 +407,7 @@ unsigned PackW32Pe::processImports() // pass 1
|
||||
|
||||
soimport += strlen(dlls[ic].name) + 1 + 4;
|
||||
|
||||
for (LE32 *tarr = dlls[ic].lookupt; *tarr; tarr++)
|
||||
for (IPTR_I(LE32, tarr, dlls[ic].lookupt); *tarr; tarr += 1)
|
||||
{
|
||||
if (*tarr & 0x80000000)
|
||||
{
|
||||
@ -419,10 +419,11 @@ unsigned PackW32Pe::processImports() // pass 1
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned len = strlen(ibuf + *tarr + 2);
|
||||
IPTR_I(const upx_byte, n, ibuf + *tarr + 2);
|
||||
unsigned len = strlen(n);
|
||||
soimport += len + 1;
|
||||
if (dlls[ic].shname == NULL || len < strlen (dlls[ic].shname))
|
||||
dlls[ic].shname = ibuf + *tarr + 2;
|
||||
dlls[ic].shname = n;
|
||||
}
|
||||
soimport++; // separator
|
||||
}
|
||||
|
||||
@ -1698,6 +1698,8 @@ void PeFile::unpack(OutputFile *fo)
|
||||
extrainfo += sizeof (oh);
|
||||
unsigned objs = oh.objects;
|
||||
|
||||
if ((int) objs <= 0)
|
||||
throwCantUnpack("unexpected value in the PE header");
|
||||
Array(pe_section_t, osection, objs);
|
||||
memcpy(osection,extrainfo,sizeof(pe_section_t) * objs);
|
||||
rvamin = osection[0].vaddr;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user