Decode: check buffer length before parsing simple key (#717)

Fixes #714
This commit is contained in:
Cameron Moore
2021-12-29 07:58:42 -06:00
committed by GitHub
parent 892df5c28e
commit 128b7a8bfb
2 changed files with 13 additions and 0 deletions
+9
View File
@@ -2338,6 +2338,15 @@ func TestIssue715(t *testing.T) {
require.Error(t, err)
}
func TestIssue714(t *testing.T) {
var v interface{}
err := toml.Unmarshal([]byte("0."), &v)
require.Error(t, err)
err = toml.Unmarshal([]byte("0={0=0,"), &v)
require.Error(t, err)
}
func TestUnmarshalDecodeErrors(t *testing.T) {
examples := []struct {
desc string