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/libmp3lame.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libavcodec/libmp3lame.c') diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index 966212dcae..e4d0e00103 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -239,11 +239,12 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, if (s->buffer_index < 4) return 0; h = AV_RB32(s->buffer); - if (ff_mpa_check_header(h) < 0) { + + ret = avpriv_mpegaudio_decode_header(&hdr, h); + if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Invalid mp3 header at start of buffer\n"); return AVERROR_BUG; - } - if (avpriv_mpegaudio_decode_header(&hdr, h)) { + } else if (ret) { av_log(avctx, AV_LOG_ERROR, "free format output not supported\n"); return -1; } -- cgit v1.2.3