Commit c54b9fc4 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/wmadec: Require previous exponents for reuse

Fixes: division by zero
Fixes: 18474/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAV2_fuzzer-5764986962182144

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 7fc1baf0
...@@ -123,6 +123,7 @@ typedef struct WMACodecContext { ...@@ -123,6 +123,7 @@ typedef struct WMACodecContext {
uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; /* padding added */ uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; /* padding added */
int last_bitoffset; int last_bitoffset;
int last_superframe_len; int last_superframe_len;
int exponents_initialized;
float noise_table[NOISE_TAB_SIZE]; float noise_table[NOISE_TAB_SIZE];
int noise_index; int noise_index;
float noise_mult; /* XXX: suppress that and integrate it in the noise array */ float noise_mult; /* XXX: suppress that and integrate it in the noise array */
......
...@@ -587,6 +587,9 @@ static int wma_decode_block(WMACodecContext *s) ...@@ -587,6 +587,9 @@ static int wma_decode_block(WMACodecContext *s)
s->exponents_bsize[ch] = bsize; s->exponents_bsize[ch] = bsize;
} }
} }
s->exponents_initialized = 1;
}else if (!s->exponents_initialized) {
return AVERROR_INVALIDDATA;
} }
/* parse spectral coefficients : just RLE encoding */ /* parse spectral coefficients : just RLE encoding */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment