diff mbox series

[FFmpeg-devel,1/2] avcodec/ac3enc_template: add fbw_channels assert

Message ID 20240205025823.4259-1-michael@niedermayer.cc
State Accepted
Commit 66f60a2355417d731b5dfd0e6048a154ba1eb088
Headers show
Series [FFmpeg-devel,1/2] avcodec/ac3enc_template: add fbw_channels assert | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Feb. 5, 2024, 2:58 a.m. UTC
fbw_channels must be > 0 as teh code is only run if cpl_enabled is set and that requires mode >= AC3_CHMODE_STEREO

CID 718138 Uninitialized scalar variable
	assumes this assert to be false

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/ac3enc_template.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer Feb. 11, 2024, 11:03 p.m. UTC | #1
On Mon, Feb 05, 2024 at 03:58:22AM +0100, Michael Niedermayer wrote:
> fbw_channels must be > 0 as teh code is only run if cpl_enabled is set and that requires mode >= AC3_CHMODE_STEREO
> 
> CID 718138 Uninitialized scalar variable
> 	assumes this assert to be false
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/ac3enc_template.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c
index ce9ef58a330..34d07cc9e5b 100644
--- a/libavcodec/ac3enc_template.c
+++ b/libavcodec/ac3enc_template.c
@@ -223,6 +223,8 @@  static void apply_channel_coupling(AC3EncodeContext *s)
         }
     }
 
+    av_assert1(s->fbw_channels > 0);
+
     /* calculate final coupling coordinates, taking into account reusing of
        coordinates in successive blocks */
     for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {