[FFmpeg-cvslog] avcodec/mp3_header_decompress_bsf: Check sample_rate_index

Michael Niedermayer git at videolan.org
Sun Dec 15 02:26:43 EET 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Dec 14 00:37:27 2019 +0100| [f064c7c449f162a9011ad890f26ceeca26934d22] | committer: Michael Niedermayer

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 at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f064c7c449f162a9011ad890f26ceeca26934d22
---

 libavcodec/mp3_header_decompress_bsf.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/mp3_header_decompress_bsf.c b/libavcodec/mp3_header_decompress_bsf.c
index 294858953c..ab3d420300 100644
--- a/libavcodec/mp3_header_decompress_bsf.c
+++ b/libavcodec/mp3_header_decompress_bsf.c
@@ -62,6 +62,11 @@ static int mp3_header_decompress(AVBSFContext *ctx, AVPacket *out)
     lsf     = sample_rate < (24000+32000)/2;
     mpeg25  = sample_rate < (12000+16000)/2;
     sample_rate_index= (header>>10)&3;
+    if (sample_rate_index == 3) {
+        ret = AVERROR_INVALIDDATA;
+        goto fail;
+    }
+
     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++){



More information about the ffmpeg-cvslog mailing list