summaryrefslogtreecommitdiff
path: root/libavcodec/mpegaudiodecheader.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2015-10-09 15:16:46 +0200
committerAnton Khirnov <anton@khirnov.net>2015-12-12 21:25:42 +0100
commit955aec3c7c7be39b659197e1ec379a09f2b7c41c (patch)
tree492417dfa6f76fc48144e966f762c4176e6a4706 /libavcodec/mpegaudiodecheader.c
parentcea1eef25c3310a68dd327eb74aae14ad3c2ddef (diff)
mpegaudiodecheader: check the header in avpriv_mpegaudio_decode_header
Almost all the places from which this function is called already check the header manually and in the two that don't (the mp3 muxer) the check should not cause any problems.
Diffstat (limited to 'libavcodec/mpegaudiodecheader.c')
-rw-r--r--libavcodec/mpegaudiodecheader.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/mpegaudiodecheader.c b/libavcodec/mpegaudiodecheader.c
index 3d840d7ecb..175f8c2ca7 100644
--- a/libavcodec/mpegaudiodecheader.c
+++ b/libavcodec/mpegaudiodecheader.c
@@ -36,6 +36,12 @@ int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
{
int sample_rate, frame_size, mpeg25, padding;
int sample_rate_index, bitrate_index;
+ int ret;
+
+ ret = ff_mpa_check_header(header);
+ if (ret < 0)
+ return ret;
+
if (header & (1<<20)) {
s->lsf = (header & (1<<19)) ? 0 : 1;
mpeg25 = 0;
@@ -116,9 +122,6 @@ int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_r
{
MPADecodeHeader s1, *s = &s1;
- if (ff_mpa_check_header(head) != 0)
- return -1;
-
if (avpriv_mpegaudio_decode_header(s, head) != 0) {
return -1;
}