avcodec/flacdec: fix off by 1 error
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 26 Nov 2014 03:07:34 +0000 (04:07 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 26 Nov 2014 03:11:16 +0000 (04:11 +0100)
Fixes assertion failure
Fixes: signal_sigsegv_324b284_1980_dilvie___the_dragonfly.flac
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/flacdec.c

index cda44ba..34a0a70 100644 (file)
@@ -366,7 +366,7 @@ static inline int decode_subframe(FLACContext *s, int channel)
 
     if (get_bits1(&s->gb)) {
         int left = get_bits_left(&s->gb);
-        if ( left < 0 ||
+        if ( left <= 0 ||
             (left < bps && !show_bits_long(&s->gb, left)) ||
                            !show_bits_long(&s->gb, bps)) {
             av_log(s->avctx, AV_LOG_ERROR,