Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using LZO in SquashFileSystemReader #19

Open
ww898 opened this issue Oct 14, 2024 · 4 comments
Open

Using LZO in SquashFileSystemReader #19

ww898 opened this issue Oct 14, 2024 · 4 comments

Comments

@ww898
Copy link

ww898 commented Oct 14, 2024

Hi @LTRData, this is the answer on your message DiscUtils#302 (comment)

I have just tried LTRData.DiscUtils.SquashFs v1.0.47 with lzo.net v0.0.6:

using var fsReader = new SquashFileSystemReader(fsStream, new SquashFileSystemReaderOptions
            {
                GetDecompressor = (kind, options) => kind switch
                {
                SquashFileSystemCompressionKind.Lzo => stream => new SeekableLzoStream(stream, CompressionMode.Decompress),
                _ => null
                }
            });

but unfortunately failed with exception:

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
   at DiscUtils.SquashFs.MetablockReader.Read(Span`1 buffer)
   at DiscUtils.SquashFs.Inode.Read(MetablockReader inodeReader)
   at DiscUtils.SquashFs.VfsSquashFileSystemReader..ctor(Stream stream, SquashFileSystemReaderOptions options)
   at DiscUtils.SquashFs.SquashFileSystemReader..ctor(Stream data, SquashFileSystemReaderOptions options)

Could you please help me?

@LTRData
Copy link
Owner

LTRData commented Oct 14, 2024

I am not entire sure. But looking at the tests for this, it looks like it is supposed to be used in a slightly different way:

GetCompressor = (kind, options) => kind == SquashFileSystemCompressionKind.Lz4 ? static stream => new SimpleLz4Stream(stream) : null

@ww898
Copy link
Author

ww898 commented Oct 14, 2024

Tried many different variants, but got the same exception. Could you please add test in your fork for LZO compression?

@LTRData
Copy link
Owner

LTRData commented Oct 14, 2024

Yes sure, I'll take a look at it!

@LTRData
Copy link
Owner

LTRData commented Oct 14, 2024

I just built an LZO compressed squashfs file system with one file and tried to decompress it using lzo.net in a similar way as you tested here. I also get some strange exception, but in my case somewhere within lzo.net library. I am not really familiar with that library, but I'll try to see if we somehow feed it with something that it does not expect. I have a bit limited time though, so it could take some time until I could look deeper into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants