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

Error on multiline basic string backslash trimming with CRLF #708

Closed
moorereason opened this issue Dec 24, 2021 · 1 comment
Closed

Error on multiline basic string backslash trimming with CRLF #708

moorereason opened this issue Dec 24, 2021 · 1 comment
Labels
bug Issues describing a bug in go-toml.
Milestone

Comments

@moorereason
Copy link
Contributor

Describe the bug
go-toml returns an error on a multiline basic string with an unescaped backslash followed by CRLF. This sequence should be valid.

To Reproduce
https://go.dev/play/p/3aIPpYSTpxO

toml.Unmarshal([]byte("0=\"\"\"\\\r\n\"\"\""), &v)

Expected behavior
I expect the parser to recognize the \r\n sequence as a whitespace character to be trimmed. The TOML spec:

For writing long strings without introducing extraneous whitespace, use a "line ending backslash". When the last non-whitespace character on a line is an unescaped \, it will be trimmed along with all whitespace (including newlines) up to the next non-whitespace character or closing delimiter.

Versions

  • go-toml: 5cbdea6
  • go version go1.17.5 linux/amd64

Additional context
Also submitted a PR to toml-test to include this case: toml-lang/toml-test#105

Found while doing differential fuzzing against toml.dart. 🎯

@pelletier pelletier added the bug Issues describing a bug in go-toml. label Dec 26, 2021
@pelletier pelletier added this to the v2.0.0-beta.5 milestone Dec 26, 2021
pelletier added a commit that referenced this issue Dec 26, 2021
@pelletier
Copy link
Owner

Should be fixed in 177b4a5. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues describing a bug in go-toml.
Projects
None yet
Development

No branches or pull requests

2 participants