mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-09 02:07:06 -06:00
4.58 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
bd1fa36322
commit
3901bf0ab8
@@ -13,9 +13,10 @@
|
||||
namespace NArchive {
|
||||
namespace NTar {
|
||||
|
||||
HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 &processedSize)
|
||||
HRESULT CInArchive::ReadBytes(void *data, size_t size, size_t &processedSize)
|
||||
{
|
||||
RINOK(ReadStream(m_Stream, data, size, &processedSize));
|
||||
processedSize = size;
|
||||
RINOK(ReadStream(m_Stream, data, &processedSize));
|
||||
m_Position += processedSize;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -93,7 +94,7 @@ HRESULT CInArchive::GetNextItemReal(bool &filled, CItemEx &item)
|
||||
|
||||
filled = false;
|
||||
|
||||
UInt32 processedSize;
|
||||
size_t processedSize;
|
||||
item.HeaderPosition = m_Position;
|
||||
RINOK(ReadBytes(record, NFileHeader::kRecordSize, processedSize));
|
||||
if (processedSize == 0 ||
|
||||
@@ -174,7 +175,8 @@ HRESULT CInArchive::GetNextItemReal(bool &filled, CItemEx &item)
|
||||
AString prefix;
|
||||
ReadString(cur, NFileHeader::kPrefixSize, prefix);
|
||||
cur += NFileHeader::kPrefixSize;
|
||||
if (!prefix.IsEmpty() && item.IsMagic())
|
||||
if (!prefix.IsEmpty() && item.IsMagic() &&
|
||||
(item.LinkFlag != 'L' /* || prefix != "00000000000" */ ))
|
||||
item.Name = prefix + AString('/') + item.Name;
|
||||
|
||||
if (item.LinkFlag == NFileHeader::NLinkFlag::kLink)
|
||||
@@ -205,10 +207,12 @@ HRESULT CInArchive::GetNextItem(bool &filled, CItemEx &item)
|
||||
return S_FALSE;
|
||||
UInt64 headerPosition = item.HeaderPosition;
|
||||
|
||||
UInt32 processedSize;
|
||||
size_t processedSize;
|
||||
AString fullName;
|
||||
char *buffer = fullName.GetBuffer((UInt32)item.Size + 1);
|
||||
RINOK(ReadBytes(buffer, (UInt32)item.Size, processedSize));
|
||||
if (item.Size > (1 << 15))
|
||||
return S_FALSE;
|
||||
char *buffer = fullName.GetBuffer((int)item.Size + 1);
|
||||
RINOK(ReadBytes(buffer, (size_t)item.Size, processedSize));
|
||||
buffer[item.Size] = '\0';
|
||||
fullName.ReleaseBuffer();
|
||||
if (processedSize != item.Size)
|
||||
@@ -224,6 +228,11 @@ HRESULT CInArchive::GetNextItem(bool &filled, CItemEx &item)
|
||||
// pax Extended Header
|
||||
return S_OK;
|
||||
}
|
||||
else if (item.LinkFlag == NFileHeader::NLinkFlag::kDumpDir)
|
||||
{
|
||||
// GNU Extensions to the Archive Format
|
||||
return S_OK;
|
||||
}
|
||||
else if (item.LinkFlag > '7' || (item.LinkFlag < '0' && item.LinkFlag != 0))
|
||||
return S_FALSE;
|
||||
return S_OK;
|
||||
|
||||
Reference in New Issue
Block a user