@@ -894,6 +894,11 @@ byteLoop:
|
||||
case c == ' ':
|
||||
if !seenSpace && i+1 < len(b) && isDigit(b[i+1]) {
|
||||
i += 2
|
||||
// Avoid reaching past the end of the document in case the time
|
||||
// is malformed. See TestIssue585.
|
||||
if i >= len(b) {
|
||||
i--
|
||||
}
|
||||
seenSpace = true
|
||||
hasTime = true
|
||||
} else {
|
||||
|
||||
@@ -1746,6 +1746,12 @@ func TestIssue588(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
func TestIssue585(t *testing.T) {
|
||||
var v interface{}
|
||||
err := toml.Unmarshal([]byte(`a=1979-05127T 0`), &v)
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
//nolint:funlen
|
||||
func TestUnmarshalDecodeErrors(t *testing.T) {
|
||||
examples := []struct {
|
||||
|
||||
Reference in New Issue
Block a user