Skip to content

Detect trailing bare carriage return in comment #132

@moorereason

Description

@moorereason

The non-conforming TOML snippet

The following snippet isn't exactly accurate since I'm showing a carriage return control character as an escape sequence.

#\r

More explicitly as a hexdump:

$ echo -n "#\r" | hexdump -C
00000000  23 0d                                             |#.|
00000002

What you expected

I expected this to be an invalid TOML document.

What you got

It's parsed a valid input.

$ echo -n "#\r" | tt_decoder
{}

Environment

toml++ version and/or commit hash:
v3 7d3770d

Any other useful information

A bare carriage return (0x0d) is not a valid whitespace or newline character within a comment. It must be followed by a line feed (0x0a). This issue only exists when it's followed by the EOF. If any other character follows the carriage return, it's properly detected as invalid input.

I plan to submit a test case for this to toml-test.

Found while doing differential fuzzing against go-toml.

Metadata

Metadata

Assignees

Labels

TOML specAn issue relating to the library's TOML spec conformance.bugSomething isn't workingimplemented in v3Fixes + features which were implemented in v3 release.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions