mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 20:04:13 +08:00
(Xp3Opener): additional sanity check when searching archives inside EXE files.
This commit is contained in:
parent
bb55fe7eed
commit
d7ef400a31
@ -315,11 +315,18 @@ NextEntry:
|
|||||||
try {
|
try {
|
||||||
for (byte* ptr = page_begin; ptr != page_end; ++ptr)
|
for (byte* ptr = page_begin; ptr != page_end; ++ptr)
|
||||||
{
|
{
|
||||||
|
// TODO: search every byte only when inside resource section,
|
||||||
|
// otherwise stick to paragraph boundary.
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (ptr[i] == s_xp3_header[i])
|
while (ptr[i] == s_xp3_header[i])
|
||||||
{
|
{
|
||||||
if (++i == s_xp3_header.Length)
|
if (++i == s_xp3_header.Length)
|
||||||
|
{
|
||||||
|
// check whether index offset is non-zero
|
||||||
|
if (0 == *(uint*)(ptr+i))
|
||||||
|
break;
|
||||||
return offset + (ptr - page_begin);
|
return offset + (ptr - page_begin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user