Handle the invalid timestamp in zipfile am: abf60c8d2e am: 69b259ccb4 am: 784cbd2c42

Change-Id: I9521cee9a8ed754af141be2d00e262a4732cc348
This commit is contained in:
Tianjie 2020-04-16 22:11:21 +00:00 committed by Automerger Merge Worker
commit 76ee7050cb
2 changed files with 4 additions and 2 deletions

View File

@ -47,9 +47,10 @@ struct ZipEntry {
// Modification time. The zipfile format specifies
// that the first two little endian bytes contain the time
// and the last two little endian bytes contain the date.
// See `GetModificationTime`.
// See `GetModificationTime`. Use signed integer to avoid the
// sub-overflow.
// TODO: should be overridden by extra time field, if present.
uint32_t mod_time;
int32_t mod_time;
// Returns `mod_time` as a broken-down struct tm.
struct tm GetModificationTime() const;

View File

@ -1299,6 +1299,7 @@ bool ZipArchive::InitializeCentralDirectory(off64_t cd_start_offset, size_t cd_s
return true;
}
// This function returns the embedded timestamp as is; and doesn't perform validations.
tm ZipEntry::GetModificationTime() const {
tm t = {};