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

Slice index out of range panic #134

Open
lchanglyft opened this issue Jun 17, 2021 · 0 comments
Open

Slice index out of range panic #134

lchanglyft opened this issue Jun 17, 2021 · 0 comments

Comments

@lchanglyft
Copy link

lchanglyft commented Jun 17, 2021

I'm calling Sdump on a complex struct and it seems to go out of bounds on a slice:

runtime.gopanic
	/opt/go/src/runtime/panic.go:965
reflect.Value.Index
	/opt/go/src/reflect/value.go:962
github.com/davecgh/go-spew/spew.(*dumpState).dumpSlice
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:238
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:352
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:394
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:391
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.(*dumpState).dumpSlice
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:238
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:352
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.(*dumpState).dumpSlice
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:238
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:352
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:421
github.com/davecgh/go-spew/spew.(*dumpState).dumpPtr
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:154
github.com/davecgh/go-spew/spew.(*dumpState).dump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:262
github.com/davecgh/go-spew/spew.fdump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:465
github.com/davecgh/go-spew/spew.Sdump
	/code/.cache/gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.2-0.20180830191138-d8f796af33cc/spew/dump.go:480

Here's the code block in value that it's hitting:

	case Slice:
		// Element flag same as Elem of Ptr.
		// Addressable, indirect, possibly read-only.
		s := (*unsafeheader.Slice)(v.ptr)
		if uint(i) >= uint(s.Len) {
			panic("reflect: slice index out of range")
		}

This was in prod so I'm not sure what the exact input was, but let me know if there's anything else that would be relevant.

Thanks!

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

1 participant