On Thu, Dec 08, 2016 at 01:12:07PM -0800, Christopher Snowhill wrote: > --- > libavformat/mp3dec.c | 70 > +++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 69 insertions(+), 1 deletion(-) > > diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c > index 56c7f8c..47f4028 100644 > --- a/libavformat/mp3dec.c > +++ b/libavformat/mp3dec.c > @@ -295,6 +295,59 @@ static void mp3_parse_vbri_tag(AVFormatContext *s, > AVStream *st, int64_t base) > } > } > > +static void mp3_parse_itunes_tag(AVFormatContext *s, AVStream *st, > MPADecodeHeader *c, int64_t base, int vbrtag_size, unsigned int *size, > uint64_t *duration) > +{ > + uint32_t v; > + AVDictionaryEntry *de; > + MP3DecContext *mp3 = s->priv_data; > + size_t length; > + uint32_t zero, start_pad, end_pad; > + uint64_t last_eight_frames_offset; > + int i; > +
> + if (!s->metadata || !(de = av_dict_get(s->metadata, "iTunSMPB", NULL, > 0))) > + return; inconsistent indention > + > + length = strlen(de->value); > + > + /* Minimum length is one digit per field plus the whitespace, maximum > length should depend on field type > + * There are four fields we need in the first six, the rest are > currently zero padding */ > + if (length < (12 + 11) || length > (10 * 8 + 2 * 16 + 11)) > + return; > + > + if (sscanf(de->value, "%"PRIx32" %"PRIx32" %"PRIx32" %"PRIx64" %"PRIx32" > %"PRIx64, &zero, &start_pad, &end_pad, duration, &zero, > &last_eight_frames_offset) < 6 || > + duration < 0 || duration is a pointer > + start_pad > (576 * 2 * 32) || > + end_pad > (576 * 2 * 64) || > + last_eight_frames_offset >= (avio_size(s->pb) - base - vbrtag_size)) > { avio_size() could fail i think > + *duration = 0; > + return; > + } > + > + mp3->start_pad = (signed int) start_pad; > + mp3->end_pad = (signed int) end_pad; useless casts > + if (end_pad >= 528 + 1) > + mp3->end_pad = end_pad - (528 + 1); > + st->start_skip_samples = mp3->start_pad + 528 + 1; > + av_log(s, AV_LOG_DEBUG, "pad %d %d\n", mp3->start_pad, mp3->end_pad); > + if (!s->pb->seekable) > + return; > + > + *size = (unsigned int) last_eight_frames_offset; > + if (avio_seek(s->pb, base + vbrtag_size + last_eight_frames_offset, > SEEK_SET) < 0) > + return; tabs are not allowed in ffmpeg git [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB What does censorship reveal? It reveals fear. -- Julian Assange
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel