[FFmpeg-devel] [PATCH]Skip padding when reading id3 tags in aiff
Matthieu Bouron
matthieu.bouron at gmail.com
Wed Apr 3 11:37:45 CEST 2013
On Wed, Apr 03, 2013 at 11:06:11AM +0200, Carl Eugen Hoyos wrote:
> Hi!
>
> Attached patch fixes ticket #2430 for me.
>
> Please review, Carl Eugen
> diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
> index 8d466fa..4a26298 100644
> --- a/libavformat/aiffdec.c
> +++ b/libavformat/aiffdec.c
> @@ -192,7 +192,7 @@ static int aiff_probe(AVProbeData *p)
> static int aiff_read_header(AVFormatContext *s)
> {
> int ret, size, filesize;
> - int64_t offset = 0;
> + int64_t offset = 0, position;
> uint32_t tag;
> unsigned version = AIFF_C_VERSION1;
> AVIOContext *pb = s->pb;
> @@ -236,6 +236,7 @@ static int aiff_read_header(AVFormatContext *s)
> goto got_sound;
> break;
> case MKTAG('I', 'D', '3', ' '):
> + position = avio_tell(pb);
> ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);
> if (id3v2_extra_meta)
> if ((ret = ff_id3v2_parse_apic(s, &id3v2_extra_meta)) < 0) {
> @@ -243,6 +244,8 @@ static int aiff_read_header(AVFormatContext *s)
> return ret;
> }
> ff_id3v2_free_extra_meta(&id3v2_extra_meta);
> + if (position + size > avio_tell(pb))
> + avio_skip(pb, position + size - avio_tell(pb));
> break;
> case MKTAG('F', 'V', 'E', 'R'): /* Version chunk */
> version = avio_rb32(pb);
The test could have been if (avio_tell(pb) & 1) avio_skip(1); since AIFF
chunks must be even aligned. I tend to prefer this check however maybe
it's better to skip extra padding ?
The patch is OK though.
Regards,
Matthieu
More information about the ffmpeg-devel
mailing list