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

fix for "panic: reflect: slice index out of range" #68

Closed
wants to merge 1 commit into from

Conversation

ivpusic
Copy link

@ivpusic ivpusic commented Feb 1, 2015

This happens when you have slice in your structure, and slice is populated with some default values before calling Decode fn.

Stacktrace:

panic: reflect: slice index out of range

goroutine 1 [running]:
reflect.Value.Index(0x6c76e0, 0xc2080332c0, 0xd7, 0x1, 0x0, 0x0, 0x0)
    /usr/local/go/src/reflect/value.go:818 +0x149
github.com/BurntSushi/toml.(*MetaData).unifySliceArray(0xc20804c910, 0x6c6360, 0xc20801f640, 0x57, 0x6c76e0, 0xc2080332c0, 0xd7, 0x0, 0x0)
    /home/ivpusic/go/src/github.com/BurntSushi/toml/decode.go:330 +0x204
github.com/BurntSushi/toml.(*MetaData).unifySlice(0xc20804c910, 0x6c6360, 0xc20801f640, 0x6c76e0, 0xc2080332c0, 0xd7, 0x0, 0x0)
    /home/ivpusic/go/src/github.com/BurntSushi/toml/decode.go:318 +0x2d2
github.com/BurntSushi/toml.(*MetaData).unify(0xc20804c910, 0x6c6360, 0xc20801f640, 0x6c76e0, 0xc2080332c0, 0xd7, 0x0, 0x0)
    /home/ivpusic/go/src/github.com/BurntSushi/toml/decode.go:206 +0xd52
github.com/BurntSushi/toml.(*MetaData).unifyStruct(0xc20804c910, 0x6d3a40, 0xc20800b6e0, 0x784de0, 0xc2080332b0, 0xd9, 0x0, 0x0)
    /home/ivpusic/go/src/github.com/BurntSushi/toml/decode.go:252 +0x7c9
github.com/BurntSushi/toml.(*MetaData).unify(0xc20804c910, 0x6d3a40, 0xc20800b6e0, 0x784de0, 0xc2080332b0, 0xd9, 0x0, 0x0)
    /home/ivpusic/go/src/github.com/BurntSushi/toml/decode.go:200 +0xdea
github.com/BurntSushi/toml.(*MetaData).unifyStruct(0xc20804c910, 0x6d3a40, 0xc20800b650, 0x784ce0, 0xc2080332b0, 0xd9, 0x0, 0x0)
    /home/ivpusic/go/src/github.com/BurntSushi/toml/decode.go:252 +0x7c9
github.com/BurntSushi/toml.(*MetaData).unify(0xc20804c910, 0x6d3a40, 0xc20800b650, 0x784ce0, 0xc2080332b0, 0xd9, 0x0, 0x0)
    /home/ivpusic/go/src/github.com/BurntSushi/toml/decode.go:200 +0xdea
github.com/BurntSushi/toml.Decode(0xc2080c8000, 0x2b6, 0x773840, 0xc2080332b0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /home/ivpusic/go/src/github.com/BurntSushi/toml/decode.go:114 +0x225
github.com/BurntSushi/toml.DecodeFile(0x7fffa2c70205, 0xb, 0x773840, 0xc2080332b0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /home/ivpusic/go/src/github.com/BurntSushi/toml/decode.go:124 +0x132
github.com/ivpusic/neo.(*Conf).Parse(0xc2080332b0, 0x7fffa2c70205, 0xb)
    /home/ivpusic/go/src/github.com/ivpusic/neo/conf.go:96 +0x10a

@otoolep
Copy link

otoolep commented Nov 11, 2015

Confirmed we in InfluxDB hit this as referenced above, and have to revert code until it's fixed.

@davidbirdsong
Copy link

I too am hitting this bug w/ default slice values.

@cespare
Copy link
Collaborator

cespare commented Feb 22, 2016

#84 is a better fix.

@cespare cespare closed this Feb 22, 2016
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

Successfully merging this pull request may close these issues.

4 participants