Decode: fix index out of range bug (#716)

Fixes #715
This commit is contained in:
Cameron Moore
2021-12-29 07:49:33 -06:00
committed by GitHub
parent d58eb50ebf
commit 892df5c28e
2 changed files with 16 additions and 0 deletions
+12
View File
@@ -2326,6 +2326,18 @@ func TestIssue710(t *testing.T) {
require.Equal(t, map[string]toml.LocalTime{"0": {Nanosecond: 111111111, Precision: 9}}, v2)
}
func TestIssue715(t *testing.T) {
var v interface{}
err := toml.Unmarshal([]byte("0=+"), &v)
require.Error(t, err)
err = toml.Unmarshal([]byte("0=-"), &v)
require.Error(t, err)
err = toml.Unmarshal([]byte("0=+A"), &v)
require.Error(t, err)
}
func TestUnmarshalDecodeErrors(t *testing.T) {
examples := []struct {
desc string