aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-12-14 00:37:27 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-04-23 21:29:01 +0200
commit74673ba2762fc410ce806ba372614827dcd86619 (patch)
treedcc64b78e92fcf7ac42a4563dd1dc5a190d5ebbc /libavcodec
parent1d7226ee65046e9261d36db00e33c7b7833e9fa2 (diff)
downloadffmpeg-74673ba2762fc410ce806ba372614827dcd86619.tar.gz
avcodec/mp3_header_decompress_bsf: Check sample_rate_index
Fixes: out of array read Fixes: 19309/clusterfuzz-testcase-minimized-ffmpeg_BSF_MP3_HEADER_DECOMPRESS_fuzzer-5651002950942720 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit f064c7c449f162a9011ad890f26ceeca26934d22) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mp3_header_decompress_bsf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/mp3_header_decompress_bsf.c b/libavcodec/mp3_header_decompress_bsf.c
index 95c0b5b769..cd0b1e12fe 100644
--- a/libavcodec/mp3_header_decompress_bsf.c
+++ b/libavcodec/mp3_header_decompress_bsf.c
@@ -51,6 +51,10 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext
lsf = sample_rate < (24000+32000)/2;
mpeg25 = sample_rate < (12000+16000)/2;
sample_rate_index= (header>>10)&3;
+ if (sample_rate_index == 3) {
+ return AVERROR_INVALIDDATA;
+ }
+
sample_rate= avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off
for(bitrate_index=2; bitrate_index<30; bitrate_index++){