summaryrefslogtreecommitdiff
path: root/libavcodec/flacdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-18 02:20:19 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-18 02:20:19 +0100
commitbbb61a1cd5cb2046e480f367a7ae58a32f2ef907 (patch)
tree0e7cc2b59558e2dc31d6b8752d90f6b5b5c886e5 /libavcodec/flacdec.c
parentf6492476a63938cc66c51bf61c88407b7749f780 (diff)
parentaf468015d972c0dec5c8c37b2685ffa5cbe4ae87 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits) als: prevent infinite loop in zero_remaining(). cook: prevent div-by-zero if channels is zero. pamenc: switch to encode2(). svq1enc: switch to encode2(). dvenc: switch to encode2(). dpxenc: switch to encode2(). pngenc: switch to encode2(). v210enc: switch to encode2(). xwdenc: switch to encode2(). ttadec: use branchless unsigned-to-signed unfolding avcodec: add a Sun Rasterfile encoder sunrast: Move common defines to a new header file. cdxl: fix video decoding for some files cdxl: fix audio for some samples apetag: add proper support for binary tags ttadec: remove dead code swscale: make access to filter data conditional on filter type. swscale: update context offsets after removal of AlpMmxFilter. prores: initialise encoder and decoder parts only when needed swscale: make monowhite/black RGB-independent. ... Conflicts: Changelog libavcodec/alsdec.c libavcodec/dpxenc.c libavcodec/golomb.h libavcodec/pamenc.c libavcodec/pngenc.c libavformat/img2.c libswscale/output.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/flacdec.c')
-rw-r--r--libavcodec/flacdec.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 055431b6d2..dc6bcaab57 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -422,7 +422,16 @@ static inline int decode_subframe(FLACContext *s, int channel)
type = get_bits(&s->gb, 6);
if (get_bits1(&s->gb)) {
+ int left = get_bits_left(&s->gb);
wasted = 1;
+ if ( left < 0 ||
+ (left < s->curr_bps && !show_bits_long(&s->gb, left)) ||
+ !show_bits_long(&s->gb, s->curr_bps)) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Invalid number of wasted bits > available bits (%d) - left=%d\n",
+ s->curr_bps, left);
+ return AVERROR_INVALIDDATA;
+ }
while (!get_bits1(&s->gb))
wasted++;
s->curr_bps -= wasted;