Skip to content

Commit 50f1a4e

Browse files
author
Kazuyoshi Kato
committed
Don't log "ignored xattr ..." warnings
It is too noisy and not really useful if the input is random. Signed-off-by: Kazuyoshi Kato <[email protected]>
1 parent 112497b commit 50f1a4e

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

contrib/fuzz/archive_fuzzer.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,25 @@ import (
2222
"os"
2323

2424
fuzz "github.com/AdaLogics/go-fuzz-headers"
25+
"github.com/sirupsen/logrus"
2526

2627
"github.com/containerd/containerd/archive"
2728
"github.com/containerd/containerd/content/local"
2829
imageArchive "github.com/containerd/containerd/images/archive"
30+
"github.com/containerd/containerd/log"
2931
)
3032

3133
// FuzzApply implements a fuzzer that applies
3234
// a fuzzed tar archive on a directory
3335
func FuzzApply(data []byte) int {
36+
ctx := context.Background()
37+
38+
// Apply() is logging the below message, which is too noisy and not really useful
39+
// if the input is random.
40+
//
41+
// level=warning msg="ignored xattr ... in archive" error="operation not supported"
42+
log.G(ctx).Logger.SetLevel(logrus.PanicLevel)
43+
3444
f := fuzz.NewConsumer(data)
3545
iters, err := f.GetInt()
3646
if err != nil {
@@ -48,7 +58,7 @@ func FuzzApply(data []byte) int {
4858
return 0
4959
}
5060
r := bytes.NewReader(rBytes)
51-
_, _ = archive.Apply(context.Background(), tmpDir, r)
61+
_, _ = archive.Apply(ctx, tmpDir, r)
5262
}
5363
return 1
5464
}

0 commit comments

Comments
 (0)