From 5f30522894d19a14324b80bc282c094dabdb31c0 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 26 Nov 2014 04:07:34 +0100 Subject: [PATCH] avcodec/flacdec: fix off by 1 error 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 --- libavcodec/flacdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index cda44ba43f..34a0a70ada 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -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,