[FFmpeg-cvslog] Check if an mp3 header is using a reserved sample rate.
Justin Ruggles
git at videolan.org
Mon Jul 14 22:35:47 CEST 2014
ffmpeg | branch: release/2.2 | Justin Ruggles <justin.ruggles at gmail.com> | Sun Jun 22 13:11:32 2014 -0400| [fcbcc561e0fdc95a7dd48b92db53846726aec27e] | committer: Luca Barbato
Check if an mp3 header is using a reserved sample rate.
Fixes an invalid read past the end of avpriv_mpa_freq_tab.
Fixes divide-by-zero due to sample_rate being set to 0.
Bug-Id: 705
CC:libav-stable at libav.org
(cherry picked from commit 44127546b0a81dc9dd6190739a62d48f0044c6f3)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fcbcc561e0fdc95a7dd48b92db53846726aec27e
---
libavcodec/mpegaudiodecheader.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/mpegaudiodecheader.c b/libavcodec/mpegaudiodecheader.c
index 69dda45..25e7319 100644
--- a/libavcodec/mpegaudiodecheader.c
+++ b/libavcodec/mpegaudiodecheader.c
@@ -24,6 +24,8 @@
* MPEG Audio header decoder.
*/
+#include "libavutil/common.h"
+
#include "avcodec.h"
#include "mpegaudio.h"
#include "mpegaudiodata.h"
@@ -45,6 +47,8 @@ int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
s->layer = 4 - ((header >> 17) & 3);
/* extract frequency */
sample_rate_index = (header >> 10) & 3;
+ if (sample_rate_index >= FF_ARRAY_ELEMS(avpriv_mpa_freq_tab))
+ sample_rate_index = 0;
sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25);
sample_rate_index += 3 * (s->lsf + mpeg25);
s->sample_rate_index = sample_rate_index;
More information about the ffmpeg-cvslog
mailing list