xi2 / xz Goto Github PK
View Code? Open in Web Editor NEWNative Go XZ decompression package
License: Other
Native Go XZ decompression package
License: Other
package main
import (
"bytes"
"encoding/hex"
"fmt"
"io/ioutil"
"xi2.org/x/xz"
)
func main() {
in, err := hex.DecodeString(`fd377a585a000004e6d6b4460201040021010800d2b974cbe0303030305d3030914584683bdedea84b03d83553a49173a3e51b1e5b1d4af106c1ae79ea4562760c29cd4bafb0003030303030303030303030303030303030303030303030`)
if err != nil {
panic(err)
}
r, err := xz.NewReader(bytes.NewReader(in), 0)
if err != nil {
fmt.Println(err)
}
_, err = ioutil.ReadAll(r)
if err != nil {
fmt.Println(err)
}
}
panic: runtime error: index out of range [recovered]
panic: runtime error: index out of range
goroutine 1 [running]:
io/ioutil.readAll.func1(0xc82003be48)
/src/go/src/io/ioutil/ioutil.go:30 +0x11e
xi2.org/x/xz.bcjX86Filter(0xc820054070, 0xc82009a000, 0x49, 0x2000, 0x10000)
/go/src/xi2.org/x/xz/dec_bcj.go:111 +0x3eb
xi2.org/x/xz.bcjApply(0xc820054070, 0xc82009a000, 0x49, 0x2000, 0xc82003ba40)
/go/src/xi2.org/x/xz/dec_bcj.go:289 +0x8b
xi2.org/x/xz.xzDecBCJRun(0xc820054070, 0xc82009e000, 0xc82005a0c0, 0x10000)
/go/src/xi2.org/x/xz/dec_bcj.go:370 +0x4fa
xi2.org/x/xz.decBlock(0xc82009c000, 0xc82005a0c0, 0xc82007b801)
/go/src/xi2.org/x/xz/dec_stream.go:251 +0x7a
xi2.org/x/xz.decMain(0xc82009c000, 0xc82005a0c0, 0x5e)
/go/src/xi2.org/x/xz/dec_stream.go:651 +0x56b
xi2.org/x/xz.xzDecRun(0xc82009c000, 0xc82005a0c0, 0x2000)
/go/src/xi2.org/x/xz/dec_stream.go:755 +0x41
xi2.org/x/xz.(*Reader).decode(0xc8200a6000, 0xc8200a6020)
/go/src/xi2.org/x/xz/reader.go:117 +0x2c9
xi2.org/x/xz.(*Reader).Read(0xc8200a6000, 0xc8200b4000, 0x200, 0x200, 0x0, 0x0, 0x0)
/go/src/xi2.org/x/xz/reader.go:163 +0x370
bytes.(*Buffer).ReadFrom(0xc82003bda0, 0x7f0d9782d1e8, 0xc8200a6000, 0x0, 0x0, 0x0)
/src/go/src/bytes/buffer.go:173 +0x23f
io/ioutil.readAll(0x7f0d9782d1e8, 0xc8200a6000, 0x200, 0x0, 0x0, 0x0, 0x0, 0x0)
/src/go/src/io/ioutil/ioutil.go:33 +0x154
io/ioutil.ReadAll(0x7f0d9782d1e8, 0xc8200a6000, 0x0, 0x0, 0x0, 0x0, 0x0)
/src/go/src/io/ioutil/ioutil.go:42 +0x51
main.main()
/t.go:22 +0x277
exit status 2
found using https://github.com/dvyukov/go-fuzz.
When attempting to download this package with go get
it returns an error.
Input
GO111MODULE=on go get github.com/xi2/[email protected]
Output
go: downloading github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8
go get github.com/xi2/[email protected]: github.com/xi2/[email protected]: reading https://proxy.golang.org/github.com/xi2/xz/@v/v0.0.0-20171230120015-48954b6210f8.zip: 403 ruleengineerror
xi2.org is currently unreachable, meaning that it's not possible to sucessfully run go get xi2.org/x/xz
.
There is a memory leak. When I decompressed all the kernel modules for analysis(about 2500 xz files), the VmRSS occupancy increased to 200M
This seems like the natural first question anyone is going to have.
Are you able to update the license to a standard one such as MIT or Apache 2?
For full XZ support, package xz is currently missing the following features:
These features appear to be little used, but xz should support them ASAP so that package users can add "xz support" to their programs without needing to specify caveats about subformats.
Also test files should be added exercising all the above.
Package xz currently supports an LZMA2 dictionary size up to 3072 MiB, but the xz specification says it can go up to 4096 MiB - 1 B. Although unlikely in practice, this should be supported for completeness.
It'd be awesome if in addition to reading xz files (works awesomely, thanks a ton for your work), that it'd be able to write out .xz files.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.