Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic when parsing "! !00 \xf6" string #833

Closed
prymitive opened this issue Mar 18, 2022 · 4 comments
Closed

Panic when parsing "! !00 \xf6" string #833

prymitive opened this issue Mar 18, 2022 · 4 comments

Comments

@prymitive
Copy link

prymitive commented Mar 18, 2022

Found via fuzzing tests added to Go 1.18

package main

import (
	"fmt"

	"gopkg.in/yaml.v3"
)

func main() {
	defer func() {
		if r := recover(); r != nil {
			fmt.Printf("panic: %s", r)
		}
	}()

	var node yaml.Node
	yaml.Unmarshal([]byte(string("! !00 \xf6")), &node)
}

https://go.dev/play/p/28Dlf2ncCct

@Zenithar
Copy link

Same with string("! !!0 \xf7")

Zenithar added a commit to Zenithar/yaml that referenced this issue May 10, 2022
Handle yaml_NO_EVENT event type to raise a parsing
error vs panic.

ref go-yaml#833

Signed-off-by: Thibault Normand <me@zenithar.org>
Zenithar added a commit to Zenithar/yaml that referenced this issue May 23, 2022
Handle yaml_NO_EVENT event type to raise a parsing
error vs panic.

ref go-yaml#833

Signed-off-by: Thibault Normand <me@zenithar.org>
@tcarreira
Copy link

I think this issue is fixed already.
At least the example you gave passes fine with no panic.

@prymitive
Copy link
Author

#666 fixed it

@dolmen
Copy link

dolmen commented Mar 14, 2024

@prymitive Could you submit your fuzzing code?

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

No branches or pull requests

4 participants