Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

import/path: strings.Split panic #69465

Closed
yuyongbo opened this issue Sep 14, 2024 · 2 comments
Closed

import/path: strings.Split panic #69465

yuyongbo opened this issue Sep 14, 2024 · 2 comments

Comments

@yuyongbo
Copy link

Go version

go version go1.21.12.linux-amd64/

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN='/usr/local/go/bin'
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/data/gopath/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/data/gopath'
GOPRIVATE=''

What did you do?

when i call strings.Split method , panic happened, please

panic({0x18bcea0?, 0x2e1a650?})
	/home/jenkins/go/pkg/mod/[golang.org/toolchain@v0.0.1-go1.21.12.linux-amd64/src/runtime/panic.go:914](https://github.com/golang/go/issues/golang.org/toolchain@v0.0.1-go1.21.12.linux-amd64/src/runtime/panic.go:914) +0x21f
strings.Count({0x0?, 0xc001e946a0?}, {0x1e467a8?, 0xc001e94680?})
	/home/jenkins/go/pkg/mod/[golang.org/toolchain@v0.0.1-go1.21.12.linux-amd64/src/strings/strings.go:46](https://github.com/golang/go/issues/golang.org/toolchain@v0.0.1-go1.21.12.linux-amd64/src/strings/strings.go:46) +0x4e
strings.genSplit({0x0, 0x2a}, {0x1e467a8, 0x1}, 0x0, 0xc00880fe00?)
	/home/jenkins/go/pkg/mod/[golang.org/toolchain@v0.0.1-go1.21.12.linux-amd64/src/strings/strings.go:248](https://github.com/golang/go/issues/golang.org/toolchain@v0.0.1-go1.21.12.linux-amd64/src/strings/strings.go:248) +0x54
strings.Split(...)

What did you see happen?

when i call strings.Split method , panic happened, please

panic({0x18bcea0?, 0x2e1a650?})
	/home/jenkins/go/pkg/mod/[golang.org/toolchain@v0.0.1-go1.21.12.linux-amd64/src/runtime/panic.go:914](https://github.com/golang/go/issues/golang.org/toolchain@v0.0.1-go1.21.12.linux-amd64/src/runtime/panic.go:914) +0x21f
strings.Count({0x0?, 0xc001e946a0?}, {0x1e467a8?, 0xc001e94680?})
	/home/jenkins/go/pkg/mod/[golang.org/toolchain@v0.0.1-go1.21.12.linux-amd64/src/strings/strings.go:46](https://github.com/golang/go/issues/golang.org/toolchain@v0.0.1-go1.21.12.linux-amd64/src/strings/strings.go:46) +0x4e
strings.genSplit({0x0, 0x2a}, {0x1e467a8, 0x1}, 0x0, 0xc00880fe00?)
	/home/jenkins/go/pkg/mod/[golang.org/toolchain@v0.0.1-go1.21.12.linux-amd64/src/strings/strings.go:248](https://github.com/golang/go/issues/golang.org/toolchain@v0.0.1-go1.21.12.linux-amd64/src/strings/strings.go:248) +0x54
strings.Split(...)

What did you expect to see?

I expect strings.Split return string slice

@gophun
Copy link

gophun commented Sep 14, 2024

See #56741 (comment)
This is also the case in your stack trace: strings.genSplit({0x0, 0x2a}, ....

Make sure that your program does not have a data race and the string does not come from an unsafe source. Otherwise, please provide a minimal reproducer.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants