profile
viewpoint

Ask questionsv3 panics on bad input

Minimal bad input example:

a:
.
-

Stack trace:

panic: internal error: attempted to parse unknown event (please report): none [recovered]
	panic: internal error: attempted to parse unknown event (please report): none

goroutine 5 [running]:
gopkg.in/yaml%2ev3.handleErr(0xc000231e20)
	/home/slrtbtfs/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20191107175235-0b070bb63a18/yaml.go:276 +0x9a
panic(0x8e18e0, 0xc000234010)
	/usr/lib/golang/src/runtime/panic.go:679 +0x1b2
gopkg.in/yaml%2ev3.(*parser).parse(0xc0001d6000, 0x0)
	/home/slrtbtfs/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20191107175235-0b070bb63a18/decode.go:158 +0x28c
gopkg.in/yaml%2ev3.(*parser).parseChild(0xc0001d6000, 0xc00022a0a0, 0xc00022a140)
	/home/slrtbtfs/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20191107175235-0b070bb63a18/decode.go:186 +0x2f
gopkg.in/yaml%2ev3.(*parser).mapping(0xc0001d6000, 0xc000214c09)
	/home/slrtbtfs/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20191107175235-0b070bb63a18/decode.go:277 +0x1a6
gopkg.in/yaml%2ev3.(*parser).parse(0xc0001d6000, 0x0)
	/home/slrtbtfs/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20191107175235-0b070bb63a18/decode.go:147 +0x1b8
gopkg.in/yaml%2ev3.(*parser).parseChild(0xc0001d6000, 0xc00022a000, 0x0)
	/home/slrtbtfs/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20191107175235-0b070bb63a18/decode.go:186 +0x2f
gopkg.in/yaml%2ev3.(*parser).document(0xc0001d6000, 0x3)
	/home/slrtbtfs/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20191107175235-0b070bb63a18/decode.go:195 +0x94
gopkg.in/yaml%2ev3.(*parser).parse(0xc0001d6000, 0xc00020e000)
	/home/slrtbtfs/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20191107175235-0b070bb63a18/decode.go:151 +0x133
gopkg.in/yaml%2ev3.(*Decoder).Decode(0xc000214e98, 0x93fc40, 0xc0001d2000, 0x0, 0x0)
	/home/slrtbtfs/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20191107175235-0b070bb63a18/yaml.go:123 +0x118
github.com/slrtbtfs/promql-lsp/langserver/cache.(*Document).parseYamls(0xc0001e7930, 0xa65000, 0xc000038680, 0x38, 0xc0000576d0)
	/home/slrtbtfs/git/github.com/slrtbtfs/promql-lsp/langserver/cache/yaml.go:51 +0x298
github.com/slrtbtfs/promql-lsp/langserver/cache.(*Document).compile(0xc0001e7930, 0xa65000, 0xc000038680, 0x0, 0x0)
	/home/slrtbtfs/git/github.com/slrtbtfs/promql-lsp/langserver/cache/compile.go:39 +0x20c
created by github.com/slrtbtfs/promql-lsp/langserver/cache.(*Document).SetContent
	/home/slrtbtfs/git/github.com/slrtbtfs/promql-lsp/langserver/cache/document.go:132 +0x255
go-yaml/yaml

Answer questions niemeyer

Tentatively closing.. if you have an actual example crashing the parser (or if I misunderstand the example), I'm of course keen on fixing it, so please comment and we reopen it.

useful!
source:https://uonfu.com/
Github User Rank List