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

panic: runtime error: index out of range in bcjX86Filter #3

Closed
ebfe opened this issue Jul 21, 2015 · 1 comment
Closed

panic: runtime error: index out of range in bcjX86Filter #3

ebfe opened this issue Jul 21, 2015 · 1 comment

Comments

@ebfe
Copy link

ebfe commented Jul 21, 2015

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.

@xi2 xi2 closed this as completed in b8b09ce Jul 21, 2015
@xi2
Copy link
Owner

xi2 commented Jul 22, 2015

I should have said thank you for reporting this, and let me know if you come across any more like it. In this case it was an error I made in my C->Go translation.

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