summaryrefslogtreecommitdiff
path: root/libavcodec/wmaprodec.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/wmaprodec.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/wmaprodec.c')
-rw-r--r--libavcodec/wmaprodec.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 1e2f246847..3fd4836fd9 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -105,7 +105,7 @@
#define MAX_FRAMESIZE 32768 ///< maximum compressed frame size
#define WMAPRO_BLOCK_MIN_BITS 6 ///< log2 of min block size
-#define WMAPRO_BLOCK_MAX_BITS 12 ///< log2 of max block size
+#define WMAPRO_BLOCK_MAX_BITS 13 ///< log2 of max block size
#define WMAPRO_BLOCK_MAX_SIZE (1 << WMAPRO_BLOCK_MAX_BITS) ///< maximum block size
#define WMAPRO_BLOCK_SIZES (WMAPRO_BLOCK_MAX_BITS - WMAPRO_BLOCK_MIN_BITS + 1) ///< possible block sizes
@@ -276,7 +276,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
WMAProDecodeCtx *s = avctx->priv_data;
uint8_t *edata_ptr = avctx->extradata;
unsigned int channel_mask;
- int i;
+ int i, bits;
int log2_max_num_subframes;
int num_possible_block_sizes;
@@ -310,8 +310,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->len_prefix = (s->decode_flags & 0x40);
/** get frame len */
- s->samples_per_frame = 1 << ff_wma_get_frame_len_bits(avctx->sample_rate,
- 3, s->decode_flags);
+ bits = ff_wma_get_frame_len_bits(avctx->sample_rate, 3, s->decode_flags);
+ if (bits > WMAPRO_BLOCK_MAX_BITS) {
+ av_log_missing_feature(avctx, "14-bits block sizes", 1);
+ return AVERROR_INVALIDDATA;
+ }
+ s->samples_per_frame = 1 << bits;
/** subframe info */
log2_max_num_subframes = ((s->decode_flags & 0x38) >> 3);