]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/motionpixels: Be more strict when parsing Huffman trees
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 29 Oct 2020 09:41:01 +0000 (10:41 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 24 Nov 2020 10:35:03 +0000 (11:35 +0100)
This ensures that the number of leafs in the Huffman tree equals the
number it is supposed to be and therefore ensures that the VLC tree is
complete, allowing us to remove checks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/motionpixels.c

index 0bf153f8832e3db39bc3a5d7a84b2024d69ba6c6..4b9830fbed94281b96f2a7078809e8d50cab2453 100644 (file)
@@ -133,7 +133,7 @@ static int mp_get_code(MotionPixelsContext *mp, GetBitContext *gb, int size, int
         if (mp_get_code(mp, gb, size, code + 1) < 0)
             return AVERROR_INVALIDDATA;
     }
-    if (mp->current_codes_count >= MAX_HUFF_CODES) {
+    if (mp->current_codes_count >= mp->codes_count) {
         av_log(mp->avctx, AV_LOG_ERROR, "too many codes\n");
         return AVERROR_INVALIDDATA;
     }