summaryrefslogtreecommitdiff
path: root/libavcodec/mpegaudiodecheader.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-23 03:05:02 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-23 03:25:04 +0200
commit2bcf34a0ef60b8026d9f10fafda9b61ad302b85a (patch)
tree41f6d476daafbe27a0dbee45f708cc2488e6142b /libavcodec/mpegaudiodecheader.c
parentc172683bf46a715baac867a49cdf621604592846 (diff)
parent44127546b0a81dc9dd6190739a62d48f0044c6f3 (diff)
downloadffmpeg-2bcf34a0ef60b8026d9f10fafda9b61ad302b85a.tar.gz
Merge commit '44127546b0a81dc9dd6190739a62d48f0044c6f3'
* commit '44127546b0a81dc9dd6190739a62d48f0044c6f3': Check if an mp3 header is using a reserved sample rate. Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegaudiodecheader.c')
-rw-r--r--libavcodec/mpegaudiodecheader.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/mpegaudiodecheader.c b/libavcodec/mpegaudiodecheader.c
index d337c458a0..5db195725f 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;