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

Invalid YAML parses successfully: indentation changed after scalar value #407

Open
braydonk opened this issue Oct 16, 2023 · 2 comments
Open
Labels
bug Something isn't working high priority

Comments

@braydonk
Copy link
Contributor

braydonk commented Oct 16, 2023

Describe the bug
The following YAML is invalid:

a: 'b'
  b: 1

It is invalid because the indentation level has changed after a scalar value, which doesn't make sense.

To Reproduce
https://go.dev/play/p/WkfZUGjlNY6

Expected behavior
This yaml should be rejected with an error.

Screenshots
If applicable, add screenshots to help explain your problem.

Version Variables

  • Go version: 1.21
  • go-yaml's Version: v1.11.2

Additional context
In the playground, I show that yaml.v3 correctly rejects the invalid yaml.

@braydonk braydonk added the bug Something isn't working label Oct 16, 2023
@braydonk braydonk changed the title Invalid YAML is accepted in Unmarshal Invalid YAML parses successfully: indentation changed after scalar value Oct 16, 2023
@braydonk
Copy link
Contributor Author

Very likely #358 is related

@goccy
Copy link
Owner

goccy commented Oct 19, 2023

Thank you for your reporting. I'll try to fix this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority
Projects
None yet
Development

No branches or pull requests

2 participants