From 263f1aeb66c5ec1231e80303a48e5ffde2c0026b Mon Sep 17 00:00:00 2001 From: Mattias Wadman Date: Tue, 18 Jan 2022 11:58:57 +0100 Subject: [PATCH] flac: Don't allow zero subframe sample size Spec says sample size can be 4-32 but that is probably before correcting for waste bits --- format/flac/flac_frame.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/format/flac/flac_frame.go b/format/flac/flac_frame.go index d1b1e43e..5401483c 100644 --- a/format/flac/flac_frame.go +++ b/format/flac/flac_frame.go @@ -378,8 +378,8 @@ func frameDecode(d *decode.D, in interface{}) interface{} { } subframeSampleSize := sampleSize - wastedBitsK - if subframeSampleSize < 0 { - d.Fatalf("negative subframeSampleSize %d", subframeSampleSize) + if subframeSampleSize < 1 { + d.Fatalf("subframeSampleSize %d < 1", subframeSampleSize) } // if channel is side, add en extra sample bit // https://github.com/xiph/flac/blob/37e675b777d4e0de53ac9ff69e2aea10d92e729c/src/libFLAC/stream_decoder.c#L2040