projectdiscovery / sqlc-go-builder

sqlc-go-builder
MIT License
12 stars 2 forks source link

Panics writing output using vitess go parser #1

Closed Ice3man543 closed 1 year ago

Ice3man543 commented 1 year ago
echo: http: panic serving [::1]:55003: runtime error: invalid memory address or nil pointer dereference
goroutine 409 [running]:
net/http.(*conn).serve.func1()
        /opt/homebrew/opt/go/libexec/src/net/http/server.go:1854 +0xb0
panic({0x10514ffa0, 0x108368190})
        /opt/homebrew/opt/go/libexec/src/runtime/panic.go:890 +0x248
vitess.io/vitess/go/vt/sqlparser.(*TrackedBuffer).printExpr(0x14002bb8280, {0x105a5f350, 0x14002bb8240}, {0x0?, 0x0?}, 0x80?)
        /Users/ice3man/go/pkg/mod/vitess.io/vitess@v0.16.1/go/vt/sqlparser/tracked_buffer.go:118 +0x148
vitess.io/vitess/go/vt/sqlparser.(*ComparisonExpr).formatFast(0x14002bb8240, 0x14002bb8280)
        /Users/ice3man/go/pkg/mod/vitess.io/vitess@v0.16.1/go/vt/sqlparser/ast_format_fast.go:1653 +0x398
vitess.io/vitess/go/vt/sqlparser.(*TrackedBuffer).printExpr(0x14002bb8280, {0x105a5efc0, 0x14002bbe020}, {0x105a5f350?, 0x14002bb8240?}, 0x2?)
        /Users/ice3man/go/pkg/mod/vitess.io/vitess@v0.16.1/go/vt/sqlparser/tracked_buffer.go:118 +0x154
vitess.io/vitess/go/vt/sqlparser.(*AndExpr).formatFast(0x14002bbe020, 0x14002bb8280)
        /Users/ice3man/go/pkg/mod/vitess.io/vitess@v0.16.1/go/vt/sqlparser/ast_format_fast.go:1624 +0x11c
vitess.io/vitess/go/vt/sqlparser.(*Where).formatFast(0x14002bb2768, 0x14002bb8280)
        /Users/ice3man/go/pkg/mod/vitess.io/vitess@v0.16.1/go/vt/sqlparser/ast_format_fast.go:1607 +0x2e4
vitess.io/vitess/go/vt/sqlparser.(*Select).formatFast(0x14003245a40, 0x14002bb8280)
        /Users/ice3man/go/pkg/mod/vitess.io/vitess@v0.16.1/go/vt/sqlparser/ast_format_fast.go:61 +0x800
vitess.io/vitess/go/vt/sqlparser.String({0x105a4de08, 0x14003245a40})
        /Users/ice3man/go/pkg/mod/vitess.io/vitess@v0.16.1/go/vt/sqlparser/tracked_buffer.go:303 +0xf4
github.com/projectdiscovery/sqlc-go-builder.(*Builder).Build(0x14002bb8080, {0x1400127cb40?, 0x1084ace38?}, {0x140011c5f00, 0x1, 0x1})

Generated during fuzzing of a using server

Ice3man543 commented 1 year ago

Done!