Skip to content

Crash in match.Row.matchAll #59

Description

@secsys-go

#PoC

	gg, _ := glob.Compile("/{a{*.json{", '/')
	gg.Match("/a/b/c/d/e/foo.json")

#CrashLog

panic: runtime error: slice bounds out of range [:6] with length 5 [recovered]
	panic: runtime error: slice bounds out of range [:6] with length 5

goroutine 34 [running]:
testing.tRunner.func1.2({0x12047c0, 0xc00019a048})
	/Users/x/sdk/go1.17.8/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
	/Users/x/sdk/go1.17.8/src/testing/testing.go:1212 +0x218
panic({0x12047c0, 0xc00019a048})
	/Users/x/sdk/go1.17.8/src/runtime/panic.go:1038 +0x215
github.com/gobwas/glob/match.Row.matchAll({{0xc0001641c0, 0x2, 0x2}, 0x5, {0xc00011c450, 0x1, 0x1}}, {0x12173c8, 0x5})
	/Users/x/go/pkg/mod/github.com/gobwas/glob@v0.2.3/match/row.go:34 +0x250
github.com/gobwas/glob/match.Row.Index({{0xc0001641c0, 0x2, 0x2}, 0x5, {0xc00011c450, 0x1, 0x1}}, {0x12173bc, 0x203000})
	/Users/x/go/pkg/mod/github.com/gobwas/glob@v0.2.3/match/row.go:68 +0x12c
github.com/gobwas/glob/match.BTree.Match({{0x125c078, 0xc00011ac40}, {0x125bda0, 0xc000130048}, {0x0, 0x0}, 0x5, 0xffffffffffffffff, 0x0, 0xffffffffffffffff}, ...)
	/Users/x/go/pkg/mod/github.com/gobwas/glob@v0.2.3/match/btree.go:82 +0x14a
github.com/gobwas/glob/match.BTree.Match({{0x125c190, 0xc00011ab80}, {0x0, 0x0}, {0x125be10, 0xc000124500}, 0x1, 0x0, 0xffffffffffffffff, 0xffffffffffffffff}, ...)
	/Users/x/go/pkg/mod/github.com/gobwas/glob@v0.2.3/match/btree.go:110 +0x292
github.com/gobwas/glob/match.BTree.Match({{0x125c190, 0xc00011ab40}, {0x0, 0x0}, {0x125be10, 0xc000124550}, 0x1, 0x0, 0xffffffffffffffff, 0xffffffffffffffff}, ...)
	/Users/x/go/pkg/mod/github.com/gobwas/glob@v0.2.3/match/btree.go:110 +0x292

#version
github.com/gobwas/glob v0.2.3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions