Skip to content

Tar archive doesn't use extension hinting on two primary functions #1254

@mitchcapper

Description

@mitchcapper

The CreateProbeDecompressionStream is the only way hinting happens with tar currently. Unfortunately that requires the reader options parameter to be passed which it is not in:

  • GetCompressionType
  • IsArchive

IsArchive is once again in the code flow for auto detection on OpenReader but that quickly causes this stack:

 	SharpCompress.dll!SharpCompress.Archives.Tar.TarArchive.IsTarFile(System.IO.Stream stream) Line 222	C#
 	SharpCompress.dll!SharpCompress.Factories.TarFactory.IsArchive(System.IO.Stream stream, string password) Line 67	C#
 	SharpCompress.dll!SharpCompress.Factories.Factory.TryOpenReader(SharpCompress.IO.SharpCompressStream stream, SharpCompress.Readers.ReaderOptions options, out SharpCompress.Readers.IReader reader) Line 89	C#
>	SharpCompress.dll!SharpCompress.Readers.ReaderFactory.OpenReader(System.IO.Stream stream, SharpCompress.Readers.ReaderOptions options) Line 51	C#

As TryOpenReader is calling IsArchive and IsArchive doesn't have the ability to take reader options it loses hinting and goes back to brute forcing.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions