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

panic: runtime error: slice bounds out of range [:1] with capacity 0 #452

Closed
0x34d opened this issue Aug 1, 2023 · 2 comments
Closed

panic: runtime error: slice bounds out of range [:1] with capacity 0 #452

0x34d opened this issue Aug 1, 2023 · 2 comments

Comments

@0x34d
Copy link
Contributor

0x34d commented Aug 1, 2023

Reproduce code:

func TestParseDNBug(t *testing.T) {
	_, _ = ParseDN(string("=#090180"))
}

run: go test -run TestParseDNBug .

BT:

--- FAIL: TestParseDNBug (0.00s)
panic: runtime error: slice bounds out of range [:1] with capacity 0 [recovered]
	panic: runtime error: slice bounds out of range [:1] with capacity 0

goroutine 6 [running]:
testing.tRunner.func1.2({0x7ab260, 0xc00002c390})
	/usr/lib/golang/src/testing/testing.go:1526 +0x24e
testing.tRunner.func1()
	/usr/lib/golang/src/testing/testing.go:1529 +0x39f
panic({0x7ab260, 0xc00002c390})
	/usr/lib/golang/src/runtime/panic.go:884 +0x213
github.com/go-asn1-ber/asn1-ber.parseBinaryFloat({0xc00002896a?, 0xc0000af6b0?, 0x1?})
	/home/0x34d/tools/go/pkg/mod/github.com/go-asn1-ber/asn1-ber@v1.5.4/real.go:98 +0x2d7
github.com/go-asn1-ber/asn1-ber.ParseReal({0xc00002896a?, 0xc00002896a?, 0x1?})
	/home/0x34d/tools/go/pkg/mod/github.com/go-asn1-ber/asn1-ber@v1.5.4/real.go:45 +0x78
github.com/go-asn1-ber/asn1-ber.readPacket({0x862460, 0xc0000af680})
	/home/0x34d/tools/go/pkg/mod/github.com/go-asn1-ber/asn1-ber@v1.5.4/ber.go:382 +0x4aa
github.com/go-asn1-ber/asn1-ber.DecodePacketErr({0xc000028960, 0x3, 0x8})
	/home/0x34d/tools/go/pkg/mod/github.com/go-asn1-ber/asn1-ber@v1.5.4/ber.go:278 +0x74
github.com/go-ldap/ldap.ParseDN({0x7cdfed, 0x8})
	/home/0x34d/project/ldap/dn.go:177 +0x36f
github.com/go-ldap/ldap.TestParseDNBug(0x0?)
	/home/0x34d/project/ldap/fuzz_test.go:9 +0x25
testing.tRunner(0xc0000deb60, 0x807270)
	/usr/lib/golang/src/testing/testing.go:1576 +0x10b
created by testing.(*T).Run
	/usr/lib/golang/src/testing/testing.go:1629 +0x3ea
FAIL	github.com/go-ldap/ldap	0.006s
FAIL
@TomSellers
Copy link
Contributor

I ran into this as well. I've opened an upstream PR
Address panics in parseBinaryFloat, add fuzzer #41
go-asn1-ber/asn1-ber#41

@0x34d
Copy link
Contributor Author

0x34d commented Sep 15, 2023

@0x34d 0x34d closed this as completed Sep 15, 2023
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

2 participants