@@ -894,6 +894,11 @@ byteLoop:
|
|||||||
case c == ' ':
|
case c == ' ':
|
||||||
if !seenSpace && i+1 < len(b) && isDigit(b[i+1]) {
|
if !seenSpace && i+1 < len(b) && isDigit(b[i+1]) {
|
||||||
i += 2
|
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
|
seenSpace = true
|
||||||
hasTime = true
|
hasTime = true
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1746,6 +1746,12 @@ func TestIssue588(t *testing.T) {
|
|||||||
require.Error(t, err)
|
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
|
//nolint:funlen
|
||||||
func TestUnmarshalDecodeErrors(t *testing.T) {
|
func TestUnmarshalDecodeErrors(t *testing.T) {
|
||||||
examples := []struct {
|
examples := []struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user