From 4d774c6a7a756111e0f6a651f04d0253be7b988e Mon Sep 17 00:00:00 2001 From: aromaa Date: Fri, 10 Apr 2026 15:56:48 +0300 Subject: [PATCH] Fix setting invalid access time fails extraction --- src/SharpCompress/Common/IEntry.Extensions.cs | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/SharpCompress/Common/IEntry.Extensions.cs b/src/SharpCompress/Common/IEntry.Extensions.cs index 7e9b79a34..7f0cda432 100644 --- a/src/SharpCompress/Common/IEntry.Extensions.cs +++ b/src/SharpCompress/Common/IEntry.Extensions.cs @@ -23,17 +23,38 @@ ExtractionOptions options { if (entry.CreatedTime.HasValue) { - nf.CreationTime = entry.CreatedTime.Value; + try + { + nf.CreationTime = entry.CreatedTime.Value; + } + catch + { + // Invalid time or the OS rejected + } } if (entry.LastModifiedTime.HasValue) { - nf.LastWriteTime = entry.LastModifiedTime.Value; + try + { + nf.LastWriteTime = entry.LastModifiedTime.Value; + } + catch + { + // Invalid time or the OS rejected + } } if (entry.LastAccessedTime.HasValue) { - nf.LastAccessTime = entry.LastAccessedTime.Value; + try + { + nf.LastAccessTime = entry.LastAccessedTime.Value; + } + catch + { + // Invalid time or the OS rejected + } } }