8000 yaml.Unmarshal crashes on "assignment to entry in nil map" · Issue #529 · go-yaml/yaml · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.
This repository was archived by the owner on Apr 1, 2025. It is now read-only.
yaml.Unmarshal crashes on "assignment to entry in nil map" #529
Closed
kubernetes-sigs/yaml
#29
@mikedanese

Description

@mikedanese

Input:

&8:
<<:
 - *8

8:
( :
 &8
 *8:
<<:
 - *8

Repro on playground:

https://play.golang.org/p/5kggj6uaRFq

panic: assignment to entry in nil map [recovered]
	panic: assignment to entry in nil map

goroutine 1 [running]:
gopkg.in/yaml%2ev2.handleErr(0x42bf78, 0x2d9c0)
	/tmp/gopath217967956/pkg/mod/gopkg.in/yaml.v2@v2.2.4/yaml.go:249 +0xc0
panic(0x179f40, 0x1e2bd8)
	/usr/local/go/src/runtime/panic.go:679 +0x240
reflect.mapassign(0x176520, 0x0, 0x40c210, 0x40c218)
	/usr/local/go/src/runtime/map.go:1329 +0x40
reflect.Value.SetMapIndex(0x176520, 0x40c1c0, 0x195, 0x175ba0, 0x40c210, 0x198, 0x1754a0, 0x40c218, 0x194, 0x29fb)
	/usr/local/go/src/reflect/value.go:1679 +0x200
gopkg.in/yaml%2ev2.(*decoder).setMapIndex(0x43c240, 0x432fc0, 0x176520, 0x40c1c0, 0x195, 0x175ba0, 0x40c210, 0x198, 0x1754a0, 0x40c218, ...)
	/tmp/gopath217967956/pkg/mod/gopkg.in/yaml.v2@v2.2.4/decode.go:686 +0x280
gopkg.in/yaml%2ev2.(*decoder).mapping(0x43c240, 0x432e00, 0x176520, 0x40c1c0, 0x195, 0x472404, 0x176520, 0x40c1c0)
	/tmp/gopath217967956/pkg/mod/gopkg.in/yaml.v2@v2.2.4/decode.go:673 +0x600
gopkg.in/yaml%2ev2.(*decoder).unmarshal(0x43c240, 0x432e00, 0x176520, 0x40c1c0, 0x195, 0x29fb, 0x472300, 0x4)
	/tmp/gopath217967956/pkg/mod/gopkg.in/yaml.v2@v2.2.4/decode.go:368 +0x1e0
gopkg.in/yaml%2ev2.(*decoder).document(0x43c240, 0x432dc0, 0x176520, 0x40c1c0, 0x195, 0x472404, 0x432dc0, 0x432e00)
	/tmp/gopath217967956/pkg/mod/gopkg.in/yaml.v2@v2.2.4/decode.go:380 +0xa0
gopkg.in/yaml%2ev2.(*decoder).unmarshal(0x43c240, 0x432dc0, 0x176520, 0x40c1c0, 0x195, 0x40c1c0, 0x195, 0x446540)
	/tmp/gopath217967956/pkg/mod/gopkg.in/yaml.v2@v2.2.4/decode.go:356 +0x280
gopkg.in/yaml%2ev2.unmarshal(0x45c030, 0x2a, 0x2a, 0x16b880, 0x40c1c0, 0x0, 0x0, 0x0)
	/tmp/gopath217967956/pkg/mod/gopkg.in/yaml.v2@v2.2.4/yaml.go:148 +0x3c0
gopkg.in/yaml%2ev2.Unmarshal(...)
	/tmp/gopath217967956/pkg/mod/gopkg.in/yaml.v2@v2.2.4/yaml.go:81
main.main()
	/tmp/sandbox393049481/prog.go:24 +0x120

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18372

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0