diff --git a/libavcodec/wma.h b/libavcodec/wma.h index 4aad713fa8..ec618d1e64 100644 --- a/libavcodec/wma.h +++ b/libavcodec/wma.h @@ -123,6 +123,7 @@ typedef struct WMACodecContext { uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; /* padding added */ int last_bitoffset; int last_superframe_len; + int exponents_initialized; float noise_table[NOISE_TAB_SIZE]; int noise_index; float noise_mult; /* XXX: suppress that and integrate it in the noise array */ diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index e814007ead..adf8e491c1 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -586,6 +586,9 @@ static int wma_decode_block(WMACodecContext *s) s->exponents_bsize[ch] = bsize; } } + s->exponents_initialized = 1; + }else if (!s->exponents_initialized) { + return AVERROR_INVALIDDATA; } /* parse spectral coefficients : just RLE encoding */