]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/ralf: Skip initializing unused filter variables
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 5 Oct 2019 17:34:17 +0000 (19:34 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 24 Oct 2019 22:22:33 +0000 (00:22 +0200)
Fixes: left shift of negative value -1
Fixes: 17890/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RALF_fuzzer-5643307467669504
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/ralf.c

index 006ab46414b15904bcb722729ff4ad57d620f5d7..1d881cf7ae396b876e991d4d69ad35a0a10cf2d9 100644 (file)
@@ -234,8 +234,10 @@ static int decode_channel(RALFContext *ctx, GetBitContext *gb, int ch,
     int *dst = ctx->channel_data[ch];
 
     ctx->filter_params = get_vlc2(gb, set->filter_params.table, 9, 2);
-    ctx->filter_bits   = (ctx->filter_params - 2) >> 6;
-    ctx->filter_length = ctx->filter_params - (ctx->filter_bits << 6) - 1;
+    if (ctx->filter_params > 1) {
+        ctx->filter_bits   = (ctx->filter_params - 2) >> 6;
+        ctx->filter_length = ctx->filter_params - (ctx->filter_bits << 6) - 1;
+    }
 
     if (ctx->filter_params == FILTER_RAW) {
         for (i = 0; i < length; i++)