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

x/tools/internal/fastwalk: problem with processing long file names #28715

Closed
mikolajb opened this issue Nov 10, 2018 · 2 comments
Closed

x/tools/internal/fastwalk: problem with processing long file names #28715

mikolajb opened this issue Nov 10, 2018 · 2 comments

Comments

@mikolajb
Copy link

@mikolajb mikolajb commented Nov 10, 2018

What version of Go are you using (go version)?

$ go version
go version go1.11.2 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN="/home/mikolaj/go/bin"
GOCACHE="/home/mikolaj/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mikolaj/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build664414908=/tmp/go-build -gno-record-gcc-switches"

What did you do?

fastwalk.direntNamlen() crashes while producing a long filename (e.g., 255 characters).

What did you expect to see?

not to crash

What did you see instead?

panic: runtime error: slice bounds out of range [recovered]
	panic: runtime error: slice bounds out of range

goroutine 5 [running]:
testing.tRunner.func1(0xc0000ae100)
	/usr/lib/go/src/testing/testing.go:792 +0x387
panic(0x51db00, 0x62dff0)
	/usr/lib/go/src/runtime/panic.go:513 +0x1b9
golang.org/x/tools/internal/fastwalk.direntNamlen(0xc0000bff00, 0x0)
	/home/mikolaj/go/src/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go:19 +0x96
golang.org/x/tools/internal/fastwalk.parseDirEnt(0xc0000bff00, 0x118, 0x1fb0, 0x7, 0xc000000000, 0x0, 0x0)
	/home/mikolaj/go/src/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go:116 +0x94
golang.org/x/tools/internal/fastwalk.readDir(0x5439c6, 0x6, 0xc0000c1f20, 0x0, 0x0)
	/home/mikolaj/go/src/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go:46 +0x14c
golang.org/x/tools/internal/fastwalk.(*walker).walk(0xc000070300, 0x5439c6, 0x6, 0x9406d00, 0x9406d81005f6818, 0x5be70f07)
	/home/mikolaj/go/src/golang.org/x/tools/internal/fastwalk/fastwalk.go:195 +0x6a
golang.org/x/tools/internal/fastwalk.TestOnSomething(0xc0000ae100)
	/home/mikolaj/go/src/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux_test.go:21 +0x14b
testing.tRunner(0xc0000ae100, 0x54c948)
	/usr/lib/go/src/testing/testing.go:827 +0xbf
created by testing.(*T).Run
	/usr/lib/go/src/testing/testing.go:878 +0x353
@gopherbot gopherbot added this to the Unreleased milestone Nov 10, 2018
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Nov 10, 2018

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 12, 2018

Change https://golang.org/cl/148884 mentions this issue: internal/fastwalk: avoids slice bounds out of range for long file names

@golang golang locked and limited conversation to collaborators Nov 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants
You can’t perform that action at this time.