[FFmpeg-devel] [PATCH] rmdec.c: correctly skip indexes

Kostya kostya.shishkov
Mon Mar 9 18:57:43 CET 2009


On Mon, Mar 09, 2009 at 12:39:16PM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Mon, Mar 9, 2009 at 1:24 PM, Kostya <kostya.shishkov at gmail.com> wrote:
> > if header_size == 0x14 and num_indices > 0 then calculate real size (and skip)
> > otherwise check header_size value to be 0x14+num_indices*0xE and throw
> > a warning if it is not (and skip that size anyway).
> 
> OK, see attached. Is the 0x14 vs. 14 thing annoying/confusing?
> 
> Ronald

> Index: ffmpeg-svn/libavformat/rmdec.c
> ===================================================================
> --- ffmpeg-svn.orig/libavformat/rmdec.c	2009-03-09 09:45:42.000000000 -0400
> +++ ffmpeg-svn/libavformat/rmdec.c	2009-03-09 12:35:31.000000000 -0400
> @@ -440,7 +440,20 @@
>              state= (state<<8) + get_byte(pb);
>  
>              if(state == MKBETAG('I', 'N', 'D', 'X')){
> -                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;
                                    ^^
                                    now that is confusing
> +                } 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);
> +                }
>                  if(len<0)
>                      continue;
>                  goto skip;




More information about the ffmpeg-devel mailing list