Skip to content

Fixed panic: runtime error: slice bounds out of range - #2

Open
Apehaenger wants to merge 4 commits into
nmcclain:masterfrom
Apehaenger:bugfix/#52-panic-runtime-error-slice-bounds-out-of-range
Open

Fixed panic: runtime error: slice bounds out of range#2
Apehaenger wants to merge 4 commits into
nmcclain:masterfrom
Apehaenger:bugfix/#52-panic-runtime-error-slice-bounds-out-of-range

Conversation

@Apehaenger

Copy link
Copy Markdown

Hi Ned!

I use your ldap fork and got a:
panic: runtime error: slice bounds out of range ...
during some Search() request.

Here's the backtrace:

github.com/nmcclain/asn1-ber.decodePacket(0xc00068608b, 0x2, 0x8, 0xc000680a20, 0xc00068608b, 0x2, 0x8)
#011/home/jebeling/go/pkg/mod/github.com/nmcclain/asn1-ber@v0.0.0-20170104154839-2661553a0484/ber.go:335 +0x7e5
github.com/nmcclain/asn1-ber.decodePacket(0xc000686037, 0x5c, 0x5c, 0xc000680780, 0xc000686037, 0x5c, 0x5c)
#011/home/jebeling/go/pkg/mod/github.com/nmcclain/asn1-ber@v0.0.0-20170104154839-2661553a0484/ber.go:341 +0x279
github.com/nmcclain/asn1-ber.decodePacket(0xc000686006, 0x8d, 0x8d, 0xc0006804e0, 0xc000686006, 0x8d, 0x8d)
#011/home/jebeling/go/pkg/mod/github.com/nmcclain/asn1-ber@v0.0.0-20170104154839-2661553a0484/ber.go:341 +0x279
github.com/nmcclain/asn1-ber.decodePacket(0xc000686000, 0x93, 0x93, 0x90, 0x90, 0x0, 0x0)
#011/home/jebeling/go/pkg/mod/github.com/nmcclain/asn1-ber@v0.0.0-20170104154839-2661553a0484/ber.go:341 +0x279
github.com/nmcclain/asn1-ber.DecodePacket(...)
#011/home/jebeling/go/pkg/mod/github.com/nmcclain/asn1-ber@v0.0.0-20170104154839-2661553a0484/ber.go:304
github.com/nmcclain/asn1-ber.ReadPacket(0xe34c00, 0xc000278000, 0xc000278000, 0xe34c00, 0xc000278000)
#011/home/jebeling/go/pkg/mod/github.com/nmcclain/asn1-ber@v0.0.0-20170104154839-2661553a0484/ber.go:253 +0x56c
github.com/nmcclain/ldap.(*Server).handleConnection(0xc000245030, 0xe48de0, 0xc000278000)
#011/usr/src/Apehaenger/ldap/server.go:231 +0x2e5
created by github.com/nmcclain/ldap.(*Server).Serve

Most (but not all) of the code got copied from Brian Ollenberger's 'Add bounds checks to prevent slice out of range panics' patch from commit https://github.com/bollenberger/asn1-ber/commit/4f968084f91b2896cfa8607310c926773b88e9e5

In addition I slightly aligned the debug output and added a go.mod file to be able to use go's replace for a local dev version.

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

Successfully merging this pull request may close these issues.

1 participant