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