diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2007-09-04 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:54 +0300 |
commit | b82f80647dd2b3890cdbebfe2aae44f7564baf5a (patch) | |
tree | 043d13c287b1485cc06cd6fb9fd6f8bfd0e061c0 /CPP/7zip/Archive | |
parent | 051769bbc577aeede90558b6ab5c9be187940ca0 (diff) |
4.54 beta
Diffstat (limited to 'CPP/7zip/Archive')
-rwxr-xr-x | CPP/7zip/Archive/7z/7zIn.cpp | 25 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/7zIn.h | 2 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Rar/RarHandler.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Tar/TarHandler.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Tar/TarIn.cpp | 2 |
5 files changed, 20 insertions, 13 deletions
diff --git a/CPP/7zip/Archive/7z/7zIn.cpp b/CPP/7zip/Archive/7z/7zIn.cpp index e04313be..a4292545 100755 --- a/CPP/7zip/Archive/7z/7zIn.cpp +++ b/CPP/7zip/Archive/7z/7zIn.cpp @@ -607,7 +607,9 @@ void CInArchive::ReadStreamsInfo( for (;;) { UInt64 type = ReadID(); - switch(type) + if (type > ((UInt32)1 << 30)) + ThrowIncorrect(); + switch((UInt32)type) { case NID::kEnd: return; @@ -627,6 +629,8 @@ void CInArchive::ReadStreamsInfo( unPackSizes, digestsDefined, digests); break; } + default: + ThrowIncorrect(); } } } @@ -664,7 +668,7 @@ void CInArchive::ReadBoolVector2(int numItems, CBoolVector &v) } void CInArchive::ReadTime(const CObjectVector<CByteBuffer> &dataVector, - CObjectVector<CFileItem> &files, UInt64 type) + CObjectVector<CFileItem> &files, UInt32 type) { CBoolVector boolVector; ReadBoolVector2(files.Size(), boolVector); @@ -881,8 +885,10 @@ HRESULT CInArchive::ReadHeader( if (type == NID::kEnd) break; UInt64 size = ReadNumber(); - database.ArchiveInfo.FileInfoPopIDs.Add(type); - switch(type) + bool isKnownType = true; + if (type > ((UInt32)1 << 30)) + isKnownType = false; + else switch((UInt32)type) { case NID::kName: { @@ -951,15 +957,16 @@ HRESULT CInArchive::ReadHeader( case NID::kLastWriteTime: case NID::kLastAccessTime: { - ReadTime(dataVector, database.Files, type); + ReadTime(dataVector, database.Files, (UInt32)type); break; } default: - { - database.ArchiveInfo.FileInfoPopIDs.DeleteBack(); - SkeepData(size); - } + isKnownType = false; } + if (isKnownType) + database.ArchiveInfo.FileInfoPopIDs.Add(type); + else + SkeepData(size); } CNum emptyFileIndex = 0; diff --git a/CPP/7zip/Archive/7z/7zIn.h b/CPP/7zip/Archive/7z/7zIn.h index 47cd3b35..aae43506 100755 --- a/CPP/7zip/Archive/7z/7zIn.h +++ b/CPP/7zip/Archive/7z/7zIn.h @@ -194,7 +194,7 @@ private: void ReadBoolVector(int numItems, CBoolVector &v); void ReadBoolVector2(int numItems, CBoolVector &v); void ReadTime(const CObjectVector<CByteBuffer> &dataVector, - CObjectVector<CFileItem> &files, UInt64 type); + CObjectVector<CFileItem> &files, UInt32 type); HRESULT ReadAndDecodePackedStreams( DECL_EXTERNAL_CODECS_LOC_VARS UInt64 baseOffset, UInt64 &dataOffset, diff --git a/CPP/7zip/Archive/Rar/RarHandler.cpp b/CPP/7zip/Archive/Rar/RarHandler.cpp index 6664cb07..fd0952d1 100755 --- a/CPP/7zip/Archive/Rar/RarHandler.cpp +++ b/CPP/7zip/Archive/Rar/RarHandler.cpp @@ -104,7 +104,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value) prop = (UInt32)numBlocks; break; } - case kpidNumVolumes: prop = (UInt32)(_archives.Size() - 1); + case kpidNumVolumes: prop = (UInt32)_archives.Size(); // case kpidCommented: prop = _archiveInfo.IsCommented(); break; } diff --git a/CPP/7zip/Archive/Tar/TarHandler.cpp b/CPP/7zip/Archive/Tar/TarHandler.cpp index d16307ca..33866d61 100755 --- a/CPP/7zip/Archive/Tar/TarHandler.cpp +++ b/CPP/7zip/Archive/Tar/TarHandler.cpp @@ -1,4 +1,4 @@ -/ Tar/Handler.cpp +// Tar/Handler.cpp #include "StdAfx.h" diff --git a/CPP/7zip/Archive/Tar/TarIn.cpp b/CPP/7zip/Archive/Tar/TarIn.cpp index 86afc482..bae1db86 100755 --- a/CPP/7zip/Archive/Tar/TarIn.cpp +++ b/CPP/7zip/Archive/Tar/TarIn.cpp @@ -219,7 +219,7 @@ HRESULT CInArchive::GetNextItem(bool &filled, CItemEx &item) item.LongLinkSize = item.HeaderPosition - headerPosition; item.HeaderPosition = headerPosition; } - else if (item.LinkFlag == 'g' || item.LinkFlag == 'x') + else if (item.LinkFlag == 'g' || item.LinkFlag == 'x' || item.LinkFlag == 'X') { // pax Extended Header return S_OK; |