From 98a24a844818961e76edf5ebf1eb2b13b039427b Mon Sep 17 00:00:00 2001 From: Jamie Brandon Date: Sun, 29 Oct 2023 19:51:59 -0700 Subject: [PATCH] Use only one thread when reading trailer as a workaround to avoid leaking goroutines during fuzzing. --- vng/object.go | 2 +- zio/zngio/trailer.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vng/object.go b/vng/object.go index 9ea7a52b10..95e84989ad 100644 --- a/vng/object.go +++ b/vng/object.go @@ -175,7 +175,7 @@ func (o *Object) newSectionReader(level int, sectionOff int64) *zngio.Reader { off += sectionOff len -= sectionOff reader := io.NewSectionReader(o.readerAt, off, len) - return zngio.NewReader(o.zctx, reader) + return zngio.NewReaderWithOpts(o.zctx, reader, zngio.ReaderOpts{Threads: 1}) } func (o *Object) NewReassemblyReader() *zngio.Reader { diff --git a/zio/zngio/trailer.go b/zio/zngio/trailer.go index e138816af0..6fa46a55fe 100644 --- a/zio/zngio/trailer.go +++ b/zio/zngio/trailer.go @@ -126,7 +126,7 @@ func findCandidate(b []byte, off int) int { } } func readTrailer(b []byte) *zed.Value { - val, _ := NewReader(zed.NewContext(), bytes.NewReader(b)).Read() + val, _ := NewReaderWithOpts(zed.NewContext(), bytes.NewReader(b), ReaderOpts{Threads: 1}).Read() return val }