avcodec/flacdec: Call ff_flacdsp_init() unconditionally
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 26 Nov 2014 02:29:03 +0000 (03:29 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 26 Nov 2014 03:11:08 +0000 (04:11 +0100)
Fixes out of array access
Fixes: signal_sigsegv_324b135_3398_cov_246853371_short.flac
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/flacdec.c

index 9b1e428..cda44ba 100644 (file)
@@ -472,10 +472,10 @@ static int decode_frame(FLACContext *s)
         ret = allocate_buffers(s);
         if (ret < 0)
             return ret;
-        ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, s->channels, s->bps);
         s->got_streaminfo = 1;
         dump_headers(s->avctx, (FLACStreaminfo *)s);
     }
+    ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, s->channels, s->bps);
 
 //    dump_headers(s->avctx, (FLACStreaminfo *)s);