summaryrefslogtreecommitdiff
path: root/libavcodec/libmp3lame.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/libmp3lame.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/libmp3lame.c')
-rw-r--r--libavcodec/libmp3lame.c7
1 files changed, 4 insertions, 3 deletions
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;
}