aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-31 14:38:16 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-06 20:30:58 +0100
commitb48dcc5613ca351db1ce5bb8f0776bd3bde52806 (patch)
treee082404102a2cd96c7cca95b9fef2f3cbb63014f
parent40872346be2e429efd860c30e194e52c70e3a552 (diff)
downloadffmpeg-b48dcc5613ca351db1ce5bb8f0776bd3bde52806.tar.gz
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/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit c54b9fc42fee613e2c4c0dae2052ff94cd15e254) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/wma.h1
-rw-r--r--libavcodec/wmadec.c3
2 files changed, 4 insertions, 0 deletions
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 */