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:
Diffstat (limited to 'CPP/7zip/Archive/Tar/TarIn.cpp')
-rw-r--r--CPP/7zip/Archive/Tar/TarIn.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/CPP/7zip/Archive/Tar/TarIn.cpp b/CPP/7zip/Archive/Tar/TarIn.cpp
index 57e18ac0..64807bfc 100644
--- a/CPP/7zip/Archive/Tar/TarIn.cpp
+++ b/CPP/7zip/Archive/Tar/TarIn.cpp
@@ -91,6 +91,16 @@ static bool ParseInt64(const char *p, Int64 &val)
return res;
}
+static bool ParseInt64_MTime(const char *p, Int64 &val)
+{
+ // rare case tar contains spaces instead of MTime
+ for (unsigned i = 0; i < 12; i++)
+ if (p[i] != ' ')
+ return ParseInt64(p, val);
+ val = 0;
+ return true;
+}
+
static bool ParseSize(const char *p, UInt64 &val)
{
if (GetBe32(p) == (UInt32)1 << 31)
@@ -124,7 +134,7 @@ API_FUNC_IsArc IsArc_Tar(const Byte *p2, size_t size)
Int64 time;
UInt32 checkSum;
CHECK(ParseSize(p, packSize)); p += 12;
- CHECK(ParseInt64(p, time)); p += 12;
+ CHECK(ParseInt64_MTime(p, time)); p += 12;
CHECK(OctalToNumber32(p, 8, checkSum));
return k_IsArc_Res_YES;
}
@@ -192,7 +202,7 @@ static HRESULT GetNextItemReal(ISequentialInStream *stream, bool &filled, CItemE
RIF(ParseSize(p, item.PackSize));
item.Size = item.PackSize;
p += 12;
- RIF(ParseInt64(p, item.MTime)); p += 12;
+ RIF(ParseInt64_MTime(p, item.MTime)); p += 12;
UInt32 checkSum;
RIF(OctalToNumber32(p, 8, checkSum));