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

path, path/filepath: Panic in Match when parsing invalid character range. #5668

Closed
gopherbot opened this issue Jun 7, 2013 · 5 comments
Closed
Milestone

Comments

@gopherbot
Copy link

by ndecker.de:

This is not good if the pattern is user supplied.

What steps will reproduce the problem?
func TestMatch(t *testing.T) {
    _, _ = filepath.Match("[", "a")
}

What is the expected output?
error: ErrBadPattern

What do you see instead?
=== RUN TestMatch
--- FAIL: TestMatch (0.00 seconds)
panic: runtime error: index out of range [recovered]
    panic: runtime error: index out of range

goroutine 7 [running]:
testing.func·004()
    /usr/local/go/src/pkg/testing/testing.go:348 +0x105
path/filepath.matchChunk(0x811c6e9, 0x1, 0x811c8f9, 0x0, 0x0, ...)
    /usr/local/go/src/pkg/path/filepath/match.go:136 +0x315
path/filepath.Match(0x811c6e9, 0x0, 0x811c8f8, 0x1, 0x18365008, ...)
    /usr/local/go/src/pkg/path/filepath/match.go:55 +0xe6


Which compiler are you using (5g, 6g, 8g, gccgo)?
go test

Which operating system are you using?
linux/i386

Which version are you using?  (run 'go version')
go version go1.1 linux/386
@DanielMorsing
Copy link
Contributor

Comment 1:

Status changed to Accepted.

@robpike
Copy link
Contributor

robpike commented Jun 8, 2013

Comment 2:

Labels changed: added priority-soon, packagebug, removed priority-triage.

Owner changed to @robpike.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 3:

Labels changed: added go1.2.

@PieterD
Copy link
Contributor

PieterD commented Jul 30, 2013

Comment 4:

I've submitted a CL for this.
https://golang.org/cl/12001056/

@robpike
Copy link
Contributor

robpike commented Jul 31, 2013

Comment 5:

This issue was closed by revision 27032fd.

Status changed to Fixed.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned robpike Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants