Regression: ArchiveFactory.IsArchive throws on non archive files in 0.42.0 #742

Closed
opened 2026-01-29 22:16:44 +00:00 by claunia · 1 comment
Owner

Originally created by @ImoutoChan on GitHub (Dec 7, 2025).

Originally assigned to: @Copilot on GitHub.

Version: 0.42.0

Calling ArchiveFactory.IsArchive on simple non-archive file throws InvalidDataException.
Works fine on 0.41.0

System.IO.InvalidDataException: Not an ARJ file (wrong magic bytes)
   at SharpCompress.Common.Arj.Headers.ArjHeader.ReadHeader(Stream stream) in /_/src/SharpCompress/Common/Arj/Headers/ArjHeader.cs:line 46
   at SharpCompress.Common.Arj.Headers.ArjMainHeader.Read(Stream stream) in /_/src/SharpCompress/Common/Arj/Headers/ArjMainHeader.cs:line 43
   at SharpCompress.Factories.ArjFactory.IsArchive(Stream stream, String password, Int32 bufferSize) in /_/src/SharpCompress/Factories/ArjFactory.cs:line 32
   at SharpCompress.Archives.ArchiveFactory.IsArchive(Stream stream, Nullable`1& type, Int32 bufferSize) in /_/src/SharpCompress/Archives/ArchiveFactory.cs:line 198
   at SharpCompress.Archives.ArchiveFactory.IsArchive(String filePath, Nullable`1& type, Int32 bufferSize) in /_/src/SharpCompress/Archives/ArchiveFactory.cs:line 177
Originally created by @ImoutoChan on GitHub (Dec 7, 2025). Originally assigned to: @Copilot on GitHub. Version: 0.42.0 Calling ArchiveFactory.IsArchive on simple non-archive file throws InvalidDataException. Works fine on 0.41.0 ``` System.IO.InvalidDataException: Not an ARJ file (wrong magic bytes) at SharpCompress.Common.Arj.Headers.ArjHeader.ReadHeader(Stream stream) in /_/src/SharpCompress/Common/Arj/Headers/ArjHeader.cs:line 46 at SharpCompress.Common.Arj.Headers.ArjMainHeader.Read(Stream stream) in /_/src/SharpCompress/Common/Arj/Headers/ArjMainHeader.cs:line 43 at SharpCompress.Factories.ArjFactory.IsArchive(Stream stream, String password, Int32 bufferSize) in /_/src/SharpCompress/Factories/ArjFactory.cs:line 32 at SharpCompress.Archives.ArchiveFactory.IsArchive(Stream stream, Nullable`1& type, Int32 bufferSize) in /_/src/SharpCompress/Archives/ArchiveFactory.cs:line 198 at SharpCompress.Archives.ArchiveFactory.IsArchive(String filePath, Nullable`1& type, Int32 bufferSize) in /_/src/SharpCompress/Archives/ArchiveFactory.cs:line 177 ```
claunia added the bug label 2026-01-29 22:16:44 +00:00
Author
Owner

@adamhathcock commented on GitHub (Dec 8, 2025):

Should be fixed in 0.42.1

@adamhathcock commented on GitHub (Dec 8, 2025): Should be fixed in 0.42.1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#742