[FFmpeg-devel] [PATCH] rmdec.c: correctly skip indexes
Reimar Döffinger
Reimar.Doeffinger
Mon Mar 9 21:40:34 CET 2009
On Mon, Mar 09, 2009 at 12:39:16PM -0400, Ronald S. Bultje wrote:
> - len = get_be16(pb) - 6;
> + int size, n_pkts;
> + size = get_be32(pb);
> + url_fskip(pb, 2);
> + n_pkts = get_be32(pb);
> + if (size == 0x14) {
> + /* some files don't add index entries to total size... */
> + len = size - 14 + n_pkts * 14;
> + } else {
> + len = size - 14;
> + if (size - 0x14 != n_pkts * 14)
> + av_log(s, AV_LOG_WARNING,
> + "Index size %d (%d pkts) looks broken.\n",
> + size, n_pkts);
> + }
Why not reusing the len variable? Also the -14 is common etc.
I consider e.g. this simpler:
len = get_be16(pb);
url_fskip(pb, 2);
n_pkts = get_be32(pb);
if (len == 20) // only index header
/// add probably forgotten size of index entries
len += npkts * 14;
else if (len != 20 + n_ptks * 14)
av_log...
// skip index and not yet read parts of header
len -= 14;
More information about the ffmpeg-devel
mailing list