aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-10-30 14:23:30 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-10-30 14:39:31 +0100
commit9f5b75f2416cf8c9a1753159b65591c249006c33 (patch)
tree77849ee696f1d16b252424e118c899a3b72c2f61
parent0c6bb53bb28c3dadb1cec97ebb587c49367a80ff (diff)
downloadffmpeg-9f5b75f2416cf8c9a1753159b65591c249006c33.tar.gz
avcodec/flacdec: make while get_bits loop more robust by checking bits left
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/flacdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 9bf950ae3e..95623cbbbc 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -366,8 +366,11 @@ static inline int decode_subframe(FLACContext *s, int channel)
bps, left);
return AVERROR_INVALIDDATA;
}
- while (!get_bits1(&s->gb))
+ while (!get_bits1(&s->gb)) {
wasted++;
+ if (get_bits_left(&s->gb) <= 0)
+ return AVERROR_INVALIDDATA;
+ }
bps -= wasted;
}
if (bps > 32) {