[FFmpeg-cvslog] avcodec/vlc: fix off by one in limit check for multi

Paul B Mahol git at videolan.org
Wed Sep 27 20:20:17 EEST 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Sep 27 19:13:58 2023 +0200| [b23eaf968e375f2d38865d90a788221caead3324] | committer: Paul B Mahol

avcodec/vlc: fix off by one in limit check for multi

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b23eaf968e375f2d38865d90a788221caead3324
---

 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;



More information about the ffmpeg-cvslog mailing list