Comments (3)
If it's LZMA, then the stream seems to need to have the size prepended to it, see the code here:
sevenzip/internal/lzma/reader.go
Lines 41 to 44 in 15d9bce
Every decoder gets passed the stream size and optionally some property bytes which it's free to interpret and use how it sees fit. So in this case I just write the size to a buffer (in little endian byte order) and then use an io.MultiReader
to concatenate that and the actual stream together.
So what is probably happening is your LZMA reader is reading the first 8 bytes as the size and then complaining the first byte after that isn't zero.
Hope that helps.
from sevenzip.
@bodgit That was it! The properties bytes from the folder coder + the size of the uncompressed data as a little endian uint64 + the uncompressed data was the correct input. How did you ever figure that one out? I can't find it discussed anywhere. Thank you very much for sharing your expertise with me!
from sevenzip.
@bodgit That was it! The properties bytes from the folder coder + the size of the uncompressed data as a little endian uint64 + the uncompressed data was the correct input. How did you ever figure that one out? I can't find it discussed anywhere. Thank you very much for sharing your expertise with me!
Sorry, I didn't even spot that I was initializing the buffer with the property bytes as well! So yes, 5 property bytes and the 8 bytes for the size.
As for how I figured it out, the source of the LZMA library I'm using is pretty easy to read, in particular https://github.com/ulikunitz/xz/blob/master/lzma/header.go and https://github.com/ulikunitz/xz/blob/master/lzma/reader.go
The header length is 13 bytes and the code explains how it's packed so comparing that to the stream showed there was clearly some header bytes I needed to add in front.
Compare this to the LZMA2 implementation which uses the same library but is initialized differently; that doesn't care or need the size of the stream but you do have to use the property bytes correctly.
from sevenzip.
Related Issues (20)
- runtime error: index out of range [0] with length 0 HOT 9
- "invalid memory address or nil pointer dereference" when opening 7z file HOT 1
- Errors are not accessible since they are private with a lower case
- Low performance of .7z files with password HOT 2
- Extract files from a self-extracting exe HOT 8
- panic: runtime error: index out of range HOT 2
- low performance for aes7z HOT 2
- warning: a function definition without a prototype is deprecated in all versions HOT 2
- 解带密码的提示 Failed to open file in archive: lzma: unsupported chunk header byte HOT 1
- about 444G big 7z file, Hangs for 8 hours, don't know what happened HOT 13
- Return list of volume archive files. HOT 14
- seek over file in archive HOT 2
- Support BCJ method HOT 8
- Support PPC method
- Unable to decrypt 7-ZIP file with password (err: breader.ReadByte: no data!) HOT 1
- Unable to decrypt 7-ZIP file with password (err: breader.ReadByte: no data!) HOT 1
- Add support for reading self-extracting archives
- Empty File processing issue HOT 4
- Fail to read .exe in .7z HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sevenzip.