pelletier / go-toml

Go library for the TOML file format
https://github.com/pelletier/go-toml
Other
1.73k stars 211 forks source link

Detect leading zero on positive float #734

Closed moorereason closed 2 years ago

moorereason commented 2 years ago

Describe the bug Given a float such as 0=+0_0.0, go-toml accepts the input as valid.

$ echo -n "0=+0_0.0" | gotoml-test-decoder
{
  "0": {
    "type": "float",
    "value": "0"
  }
}

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

toml.Unmarshal([]byte("0=+0_0.0"), &v)

Expected behavior Expected to see an error about leading zero on a float number.

Versions

Additional context Found while doing differential fuzzing against tomlplusplus/v3.

pelletier commented 2 years ago

Thanks!