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. --- libavformat/mp3dec.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'libavformat/mp3dec.c') diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index a875b82c0a..8904797491 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -275,14 +275,16 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) MPADecodeHeader c; int vbrtag_size = 0; MP3DecContext *mp3 = s->priv_data; + int ret; ffio_init_checksum(s->pb, ff_crcA001_update, 0); v = avio_rb32(s->pb); - if(ff_mpa_check_header(v) < 0) - return -1; - if (avpriv_mpegaudio_decode_header(&c, v) == 0) + ret = avpriv_mpegaudio_decode_header(&c, v); + if (ret < 0) + return ret; + else if (ret == 0) vbrtag_size = c.frame_size; if(c.layer != 3) return -1; @@ -388,8 +390,8 @@ static int check(AVIOContext *pb, int64_t pos, int64_t *out_pos) header = avio_rb32(pb); - if (ff_mpa_check_header(header) < 0 || - avpriv_mpegaudio_decode_header(&mh, header)) + + if (avpriv_mpegaudio_decode_header(&mh, header)) break; out_pos[i] = off; } -- cgit v1.2.3