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

Bare carriage return in comment #321

Closed
moorereason opened this issue Nov 4, 2021 · 0 comments
Closed

Bare carriage return in comment #321

moorereason opened this issue Nov 4, 2021 · 0 comments
Labels

Comments

@moorereason
Copy link

Given the input # this is a test\ra=1, this package decodes the input as a=1.

Reproduction

https://play.golang.org/p/YhQC0y2Dd5w

toml.Unmarshal([]byte("# this is a test\ra=1"), &v)

Or with the toml-test decoder:

$ echo "# this is a test\ra=1" | toml-test-decoder2
{
  "a": {
    "type": "integer",
    "value": "1"
  }
}

Expectation

I would expect an error. \r is not an allowed control character for a comment. Without an trailing line feed (\n), it should not be considered a newline sequence (\r\n).

I found this issue while doing differential fuzzing against go-toml. Interestingly, go-toml also doesn't return an error, but it does treat the whole line as a comment.

@arp242 arp242 added the bug label Nov 16, 2021
arp242 added a commit to toml-lang/toml-test that referenced this issue Nov 25, 2021
@arp242 arp242 closed this as completed in 4272474 Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants