Browse Source

avcodec/wmadec: Keep track of exponent initialization per channel

Fixes: division by 0
Fixes: 19123/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAV2_fuzzer-5655493121146880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit bf5c850b79)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.0.6
Michael Niedermayer 6 years ago
parent
commit
47331a23e1
2 changed files with 7 additions and 4 deletions
  1. +1
    -1
      libavcodec/wma.h
  2. +6
    -3
      libavcodec/wmadec.c

+ 1
- 1
libavcodec/wma.h View File

@@ -123,7 +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;
int exponents_initialized[MAX_CHANNELS];
float noise_table[NOISE_TAB_SIZE];
int noise_index;
float noise_mult; /* XXX: suppress that and integrate it in the noise array */


+ 6
- 3
libavcodec/wmadec.c View File

@@ -585,11 +585,14 @@ static int wma_decode_block(WMACodecContext *s)
decode_exp_lsp(s, ch);
}
s->exponents_bsize[ch] = bsize;
s->exponents_initialized[ch] = 1;
}
}
s->exponents_initialized = 1;
}else if (!s->exponents_initialized) {
return AVERROR_INVALIDDATA;
}

for (ch = 0; ch < s->avctx->channels; ch++) {
if (s->channel_coded[ch] && !s->exponents_initialized[ch])
return AVERROR_INVALIDDATA;
}

/* parse spectral coefficients : just RLE encoding */


Loading…
Cancel
Save