This commit is contained in:
Igor Pavlov
2016-09-29 00:00:00 +00:00
committed by Kornel Lesiński
parent 1eddf527ca
commit 232ce79574
83 changed files with 1088 additions and 307 deletions

View File

@@ -507,7 +507,7 @@ HRESULT CHeaderRec::Parse(const Byte *p)
// LeafRecords = Get32(p + 6);
FirstLeafNode = Get32(p + 0xA);
// LastLeafNode = Get32(p + 0xE);
UInt32 nodeSize = Get16(p + 0x12);
const UInt32 nodeSize = Get16(p + 0x12);
unsigned i;
for (i = 9; ((UInt32)1 << i) != nodeSize; i++)
@@ -583,9 +583,9 @@ HRESULT CDatabase::LoadExtentFile(const CFork &fork, IInStream *inStream, CObjec
for (unsigned i = 0; i < desc.NumRecords; i++)
{
UInt32 nodeSize = (UInt32)1 << hr.NodeSizeLog;
UInt32 offs = Get16(p + nodeOffset + nodeSize - (i + 1) * 2);
UInt32 offsNext = Get16(p + nodeOffset + nodeSize - (i + 2) * 2);
const UInt32 nodeSize = (UInt32)1 << hr.NodeSizeLog;
const UInt32 offs = Get16(p + nodeOffset + nodeSize - (i + 1) * 2);
const UInt32 offsNext = Get16(p + nodeOffset + nodeSize - (i + 2) * 2);
if (offs > nodeSize || offsNext > nodeSize)
return S_FALSE;
UInt32 recSize = offsNext - offs;
@@ -727,12 +727,12 @@ HRESULT CDatabase::LoadAttrs(const CFork &fork, IInStream *inStream, IArchiveOpe
for (unsigned i = 0; i < desc.NumRecords; i++)
{
UInt32 nodeSize = (1 << hr.NodeSizeLog);
UInt32 offs = Get16(p + nodeOffset + nodeSize - (i + 1) * 2);
UInt32 offsNext = Get16(p + nodeOffset + nodeSize - (i + 2) * 2);
const UInt32 nodeSize = (1 << hr.NodeSizeLog);
const UInt32 offs = Get16(p + nodeOffset + nodeSize - (i + 1) * 2);
const UInt32 offsNext = Get16(p + nodeOffset + nodeSize - (i + 2) * 2);
UInt32 recSize = offsNext - offs;
if (offs >= nodeSize
|| offsNext >= nodeSize
|| offsNext > nodeSize
|| offsNext < offs)
return S_FALSE;
@@ -898,7 +898,7 @@ HRESULT CDatabase::LoadCatalog(const CFork &fork, const CObjectVector<CIdExtents
return S_FALSE;
usedBuf[node] = 1;
size_t nodeOffset = (size_t)node << hr.NodeSizeLog;
const size_t nodeOffset = (size_t)node << hr.NodeSizeLog;
CNodeDescriptor desc;
desc.Parse(p + nodeOffset);
if (!desc.CheckNumRecords(hr.NodeSizeLog))
@@ -908,12 +908,12 @@ HRESULT CDatabase::LoadCatalog(const CFork &fork, const CObjectVector<CIdExtents
for (unsigned i = 0; i < desc.NumRecords; i++)
{
UInt32 nodeSize = (1 << hr.NodeSizeLog);
UInt32 offs = Get16(p + nodeOffset + nodeSize - (i + 1) * 2);
UInt32 offsNext = Get16(p + nodeOffset + nodeSize - (i + 2) * 2);
const UInt32 nodeSize = (1 << hr.NodeSizeLog);
const UInt32 offs = Get16(p + nodeOffset + nodeSize - (i + 1) * 2);
const UInt32 offsNext = Get16(p + nodeOffset + nodeSize - (i + 2) * 2);
UInt32 recSize = offsNext - offs;
if (offs >= nodeSize
|| offs >= nodeSize
|| offsNext > nodeSize
|| offsNext < offs
|| recSize < 6)
return S_FALSE;