aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-06-15 21:34:18 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-07-19 12:59:50 +0200
commitc5f265bb2468c3e0996329ada11b2792dd9bd1a2 (patch)
treec866fe8fd55bc53c4943e59ad50ae72178af3f35
parented4c6ce750cf3542f30762334fb1d6696e4d79c6 (diff)
downloadffmpeg-c5f265bb2468c3e0996329ada11b2792dd9bd1a2.tar.gz
avcodec/atrac9dec: Check conditions before apply_band_extension() to avoid out of array read in initialization of unused variables
Fixes: global-buffer-overflow Fixes: 15247/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ATRAC9_fuzzer-5671602181636096 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/atrac9dec.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c
index 4d490daeb0..2e23ea44e8 100644
--- a/libavcodec/atrac9dec.c
+++ b/libavcodec/atrac9dec.c
@@ -539,9 +539,6 @@ static inline void apply_band_extension(ATRAC9Context *s, ATRAC9BlockData *b,
at9_q_unit_to_coeff_idx[g_units[3]],
};
- if (!b->has_band_ext || !b->has_band_ext_data)
- return;
-
for (int ch = 0; ch <= stereo; ch++) {
ATRAC9ChannelData *c = &b->channel[ch];
@@ -751,7 +748,9 @@ static int atrac9_decode_block(ATRAC9Context *s, GetBitContext *gb,
apply_intensity_stereo(s, b, stereo);
apply_scalefactors (s, b, stereo);
- apply_band_extension (s, b, stereo);
+
+ if (b->has_band_ext && b->has_band_ext_data)
+ apply_band_extension (s, b, stereo);
imdct:
for (int i = 0; i <= stereo; i++) {