-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
Hi, noticed that if DSN provided containes invalid sheme, url object returns no error and an empty host. It gives panic in method ensureHavePort(), because there is no check if the address is empty.
My pull request containes length check in method, also added returning error on parsing dsn stage. Plus added some tests :)
The error trace:
panic: runtime error: index out of range [0] with length 0
goroutine 72 [running]:
github.com/mailru/go-clickhouse.ensureHavePort({0x0, 0x0})
/Users/kurysheva/go/pkg/mod/github.com/mailru/[email protected]/config.go:187 +0x153
github.com/mailru/go-clickhouse.(*Config).url(0xc000240160, 0xc000687990?, 0x0)
/Users/kurysheva/go/pkg/mod/github.com/mailru/[email protected]/config.go:85 +0x53
github.com/mailru/go-clickhouse.newConn(0xc000240160)
/Users/kurysheva/go/pkg/mod/github.com/mailru/[email protected]/conn.go:65 +0x18c
github.com/mailru/go-clickhouse.(*chDriver).Open(0x16e28c0?, {0xc000260540?, 0xc?})
/Users/kurysheva/go/pkg/mod/github.com/mailru/[email protected]/clickhouse.go:22 +0x45
Metadata
Metadata
Assignees
Labels
No labels