Skip to content

Commit 65ae991

Browse files
authored
Merge pull request #2479 from AdamKorcz/fuzz2
add fuzz test for ConvertToRaw
2 parents 67d3be3 + 6b99644 commit 65ae991

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pkg/nativeimgutil/fuzz_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package nativeimgutil
2+
3+
import (
4+
"os"
5+
"path/filepath"
6+
"testing"
7+
)
8+
9+
func FuzzConvertToRaw(f *testing.F) {
10+
f.Fuzz(func(t *testing.T, imgData []byte, withBacking bool, size int64) {
11+
srcPath := filepath.Join(t.TempDir(), "src.img")
12+
destPath := filepath.Join(t.TempDir(), "dest.img")
13+
err := os.WriteFile(srcPath, imgData, 0o600)
14+
if err != nil {
15+
return
16+
}
17+
_ = ConvertToRaw(srcPath, destPath, &size, withBacking)
18+
})
19+
}

0 commit comments

Comments
 (0)