From b23eaf968e375f2d38865d90a788221caead3324 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Wed, 27 Sep 2023 19:13:58 +0200 Subject: [PATCH] avcodec/vlc: fix off by one in limit check for multi --- libavcodec/vlc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/vlc.c b/libavcodec/vlc.c index 21b9fffe27..e4bbf2945e 100644 --- a/libavcodec/vlc.c +++ b/libavcodec/vlc.c @@ -368,7 +368,7 @@ static void add_level(VLC_MULTI_ELEM *table, const int nb_elems, uint32_t code; sym = buf[t].symbol; - if (l > curlimit) + if (l >= curlimit) return; code = curcode + (buf[t].code >> curlen); newlimit = curlimit - l; @@ -401,7 +401,7 @@ static int vlc_multi_gen(VLC_MULTI_ELEM *table, const VLC *single, { int minbits, maxbits, max = nb_codes-1; unsigned count[VLC_MULTI_MAX_SYMBOLS-1] = { 0, }; - VLC_MULTI_ELEM info = { { 0, }, 0, }; + VLC_MULTI_ELEM info = { { 0, }, 0, 0, }; minbits = buf[0].bits; maxbits = buf[0].bits;