From 955aec3c7c7be39b659197e1ec379a09f2b7c41c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 9 Oct 2015 15:16:46 +0200 Subject: 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. --- libavcodec/mpegaudiodecheader.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libavcodec/mpegaudiodecheader.c') 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; } -- cgit v1.2.3