Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2007-09-04 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:54 +0300
commitb82f80647dd2b3890cdbebfe2aae44f7564baf5a (patch)
tree043d13c287b1485cc06cd6fb9fd6f8bfd0e061c0 /CPP/7zip/Archive/7z
parent051769bbc577aeede90558b6ab5c9be187940ca0 (diff)
4.54 beta
Diffstat (limited to 'CPP/7zip/Archive/7z')
-rwxr-xr-xCPP/7zip/Archive/7z/7zIn.cpp25
-rwxr-xr-xCPP/7zip/Archive/7z/7zIn.h2
2 files changed, 17 insertions, 10 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,