armor,internal/format: restore CCTV fuzz seed corpora

Reported by Joe Doyle of Trail of Bits.
This commit is contained in:
Filippo Valsorda
2026-08-29 19:30:10 +02:00
parent 6424047654
commit e8d1b2f216
2 changed files with 16 additions and 8 deletions
+7 -4
View File
@@ -11,11 +11,11 @@ import (
"bytes"
"errors"
"io"
"os"
"path/filepath"
"io/fs"
"strings"
"testing"
agetest "c2sp.org/CCTV/age"
"filippo.io/age/internal/format"
)
@@ -159,12 +159,12 @@ func TestParseLimits(t *testing.T) {
}
func FuzzMalleability(f *testing.F) {
tests, err := filepath.Glob("../../testdata/testkit/*")
tests, err := fs.ReadDir(agetest.Vectors, ".")
if err != nil {
f.Fatal(err)
}
for _, test := range tests {
contents, err := os.ReadFile(test)
contents, err := fs.ReadFile(agetest.Vectors, test.Name())
if err != nil {
f.Fatal(err)
}
@@ -174,6 +174,9 @@ func FuzzMalleability(f *testing.F) {
}
f.Add(contents)
}
if len(tests) == 0 {
f.Fatal("no test vectors")
}
f.Fuzz(func(t *testing.T, data []byte) {
h, payload, err := format.Parse(bytes.NewReader(data))
if err != nil {