diff options
Diffstat (limited to 'ffmpeg/libavcodec/wmadec.c')
| -rw-r--r-- | ffmpeg/libavcodec/wmadec.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/ffmpeg/libavcodec/wmadec.c b/ffmpeg/libavcodec/wmadec.c index 0648c1e..e6a0b04 100644 --- a/ffmpeg/libavcodec/wmadec.c +++ b/ffmpeg/libavcodec/wmadec.c @@ -33,6 +33,7 @@ * should be 4 extra bytes for v1 data and 6 extra bytes for v2 data. */ +#include "libavutil/attributes.h" #include "avcodec.h" #include "internal.h" #include "wma.h" @@ -66,7 +67,7 @@ static void dump_floats(WMACodecContext *s, const char *name, int prec, const fl } #endif -static int wma_decode_init(AVCodecContext * avctx) +static av_cold int wma_decode_init(AVCodecContext * avctx) { WMACodecContext *s = avctx->priv_data; int i, flags2; @@ -150,7 +151,7 @@ static inline float pow_m1_4(WMACodecContext *s, float x) return s->lsp_pow_e_table[e] * (a + b * t.f); } -static void wma_lsp_to_curve_init(WMACodecContext *s, int frame_len) +static av_cold void wma_lsp_to_curve_init(WMACodecContext *s, int frame_len) { float wdel, a, b; int i, e, m; @@ -511,6 +512,10 @@ static int wma_decode_block(WMACodecContext *s) coef escape coding */ total_gain = 1; for(;;) { + if (get_bits_left(&s->gb) < 7) { + av_log(s->avctx, AV_LOG_ERROR, "total_gain overread\n"); + return AVERROR_INVALIDDATA; + } a = get_bits(&s->gb, 7); total_gain += a; if (a != 127) @@ -943,6 +948,7 @@ static av_cold void flush(AVCodecContext *avctx) #if CONFIG_WMAV1_DECODER AVCodec ff_wmav1_decoder = { .name = "wmav1", + .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"), .type = AVMEDIA_TYPE_AUDIO, .id = AV_CODEC_ID_WMAV1, .priv_data_size = sizeof(WMACodecContext), @@ -951,7 +957,6 @@ AVCodec ff_wmav1_decoder = { .decode = wma_decode_superframe, .flush = flush, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"), .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }, }; @@ -959,6 +964,7 @@ AVCodec ff_wmav1_decoder = { #if CONFIG_WMAV2_DECODER AVCodec ff_wmav2_decoder = { .name = "wmav2", + .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"), .type = AVMEDIA_TYPE_AUDIO, .id = AV_CODEC_ID_WMAV2, .priv_data_size = sizeof(WMACodecContext), @@ -967,7 +973,6 @@ AVCodec ff_wmav2_decoder = { .decode = wma_decode_superframe, .flush = flush, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"), .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }, }; |
