HfsHandler.cpp (p7zip_15.14.1_src_all) | : | HfsHandler.cpp (p7zip_16.02_src_all) | ||
---|---|---|---|---|
skipping to change at line 877 | skipping to change at line 877 | |||
CRecordVector<CIdIndexPair> IdToIndexMap; | CRecordVector<CIdIndexPair> IdToIndexMap; | |||
IdToIndexMap.ClearAndReserve(reserveSize); | IdToIndexMap.ClearAndReserve(reserveSize); | |||
CByteBuffer buf; | CByteBuffer buf; | |||
RINOK(ReadFile(fork, buf, inStream)); | RINOK(ReadFile(fork, buf, inStream)); | |||
const Byte *p = (const Byte *)buf; | const Byte *p = (const Byte *)buf; | |||
// CNodeDescriptor nodeDesc; | // CNodeDescriptor nodeDesc; | |||
// nodeDesc.Parse(p); | // nodeDesc.Parse(p); | |||
CHeaderRec hr; | CHeaderRec hr; | |||
hr.Parse(p + kNodeDescriptor_Size); | RINOK(hr.Parse(p + kNodeDescriptor_Size)); | |||
// CaseSensetive = (Header.IsHfsX() && hr.KeyCompareType == 0xBC); | // CaseSensetive = (Header.IsHfsX() && hr.KeyCompareType == 0xBC); | |||
if ((buf.Size() >> hr.NodeSizeLog) < hr.TotalNodes) | if ((buf.Size() >> hr.NodeSizeLog) < hr.TotalNodes) | |||
return S_FALSE; | return S_FALSE; | |||
CByteBuffer usedBuf(hr.TotalNodes); | CByteBuffer usedBuf(hr.TotalNodes); | |||
memset(usedBuf, 0, hr.TotalNodes); | memset(usedBuf, 0, hr.TotalNodes); | |||
CFork resFork; | CFork resFork; | |||
skipping to change at line 988 | skipping to change at line 988 | |||
item.MTime = Get32(r + 0x10); | item.MTime = Get32(r + 0x10); | |||
// item.AttrMTime = Get32(r + 0x14); | // item.AttrMTime = Get32(r + 0x14); | |||
item.ATime = Get32(r + 0x18); | item.ATime = Get32(r + 0x18); | |||
// item.BackupDate = Get32(r + 0x1C); | // item.BackupDate = Get32(r + 0x1C); | |||
/* | /* | |||
item.OwnerID = Get32(r + 0x20); | item.OwnerID = Get32(r + 0x20); | |||
item.GroupID = Get32(r + 0x24); | item.GroupID = Get32(r + 0x24); | |||
item.AdminFlags = r[0x28]; | item.AdminFlags = r[0x28]; | |||
item.OwnerFlags = r[0x29]; | item.OwnerFlags = r[0x29]; | |||
*/ | ||||
item.FileMode = Get16(r + 0x2A); | item.FileMode = Get16(r + 0x2A); | |||
/* | ||||
item.special.iNodeNum = Get16(r + 0x2C); // or .linkCount | item.special.iNodeNum = Get16(r + 0x2C); // or .linkCount | |||
item.FileType = Get32(r + 0x30); | item.FileType = Get32(r + 0x30); | |||
item.FileCreator = Get32(r + 0x34); | item.FileCreator = Get32(r + 0x34); | |||
item.FinderFlags = Get16(r + 0x38); | item.FinderFlags = Get16(r + 0x38); | |||
item.Point[0] = Get16(r + 0x3A); // v | item.Point[0] = Get16(r + 0x3A); // v | |||
item.Point[1] = Get16(r + 0x3C); // h | item.Point[1] = Get16(r + 0x3C); // h | |||
*/ | */ | |||
// const refIndex = Refs.Size(); | // const refIndex = Refs.Size(); | |||
CIdIndexPair pair; | CIdIndexPair pair; | |||
skipping to change at line 1570 | skipping to change at line 1572 | |||
{ | { | |||
UInt64 rem = item.UnpackSize - outPos; | UInt64 rem = item.UnpackSize - outPos; | |||
if (rem == 0) | if (rem == 0) | |||
return S_FALSE; | return S_FALSE; | |||
UInt32 blockSize = kCompressionBlockSize; | UInt32 blockSize = kCompressionBlockSize; | |||
if (rem < kCompressionBlockSize) | if (rem < kCompressionBlockSize) | |||
blockSize = (UInt32)rem; | blockSize = (UInt32)rem; | |||
UInt32 size = GetUi32(tableBuf + i * 8 + 4); | UInt32 size = GetUi32(tableBuf + i * 8 + 4); | |||
if (size > buf.Size() || size > kCompressionBlockSize + 1) | ||||
return S_FALSE; | ||||
RINOK(ReadStream_FALSE(inStream, buf, size)); | RINOK(ReadStream_FALSE(inStream, buf, size)); | |||
if ((buf[0] & 0xF) == 0xF) | if ((buf[0] & 0xF) == 0xF) | |||
{ | { | |||
// that code was not tested. Are there HFS archives with uncompressed bloc k | // that code was not tested. Are there HFS archives with uncompressed bloc k | |||
if (size - 1 != blockSize) | if (size - 1 != blockSize) | |||
return S_FALSE; | return S_FALSE; | |||
if (outStream) | if (outStream) | |||
{ | { | |||
skipping to change at line 1757 | skipping to change at line 1762 | |||
break; | break; | |||
const CExtent &e = fork.Extents[extentIndex]; | const CExtent &e = fork.Extents[extentIndex]; | |||
RINOK(_stream->Seek((UInt64)e.Pos << Header.BlockSizeLog, STREAM_SEEK_ SET, NULL)); | RINOK(_stream->Seek((UInt64)e.Pos << Header.BlockSizeLog, STREAM_SEEK_ SET, NULL)); | |||
UInt64 extentRem = (UInt64)e.NumBlocks << Header.BlockSizeLog; | UInt64 extentRem = (UInt64)e.NumBlocks << Header.BlockSizeLog; | |||
while (extentRem != 0) | while (extentRem != 0) | |||
{ | { | |||
UInt64 rem = fork.Size - pos; | UInt64 rem = fork.Size - pos; | |||
if (rem == 0) | if (rem == 0) | |||
{ | { | |||
// Here we check that there are no extra (empty) blocks in last ex tent. | // Here we check that there are no extra (empty) blocks in last ex tent. | |||
if (extentRem >= (UInt64)((UInt32)1 << Header.BlockSizeLog)) | if (extentRem >= ((UInt64)1 << Header.BlockSizeLog)) | |||
res = NExtract::NOperationResult::kDataError; | res = NExtract::NOperationResult::kDataError; | |||
break; | break; | |||
} | } | |||
size_t cur = kBufSize; | size_t cur = kBufSize; | |||
if (cur > rem) | if (cur > rem) | |||
cur = (size_t)rem; | cur = (size_t)rem; | |||
if (cur > extentRem) | if (cur > extentRem) | |||
cur = (size_t)extentRem; | cur = (size_t)extentRem; | |||
RINOK(ReadStream(_stream, buf, &cur)); | RINOK(ReadStream(_stream, buf, &cur)); | |||
if (cur == 0) | if (cur == 0) | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 7 lines changed or added |