]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/lagarith: Sanity check scale
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 28 Jan 2020 19:12:25 +0000 (20:12 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 3 Feb 2020 22:59:07 +0000 (23:59 +0100)
A value of 24 and above can collaps the range to 0 which would not work.

Fixes: Timeout (75sec -> 21sec)
Fixes: 18707/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-5708950892969984
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/lagarith.c

index 59169be5dea5231324fd8149f333ae02d6df1059..0a45812bc14f38c481f2d316976e8e0cd1579854 100644 (file)
@@ -226,6 +226,9 @@ static int lag_read_prob_header(lag_rac *rac, GetBitContext *gb)
         }
     }
 
+    if (scale_factor > 23)
+        return AVERROR_INVALIDDATA;
+
     rac->scale = scale_factor;
 
     /* Fill probability array with cumulative probability for each symbol. */