(Xp3Opener): additional sanity check when searching archives inside EXE files.

This commit is contained in:
morkt 2016-03-05 17:18:28 +04:00
parent bb55fe7eed
commit d7ef400a31

View File

@ -315,11 +315,18 @@ NextEntry:
try {
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;
while (ptr[i] == s_xp3_header[i])
{
if (++i == s_xp3_header.Length)
{
// check whether index offset is non-zero
if (0 == *(uint*)(ptr+i))
break;
return offset + (ptr - page_begin);
}
}
}
}