[FFmpeg-devel] [PATCH] reduce score returned by FLIC format

Benoit Fouet benoit.fouet
Wed Mar 26 15:17:23 CET 2008


Hi Mike,

Mike Melanson wrote:
> Here's a patch. Sane enough? I declared that each dimension must be
> between 4..2048. That should be generous enough. And I also used Aurel's
> suggestion (90% sure).
>
>   
> ------------------------------------------------------------------------
>
> Index: libavformat/flic.c
> ===================================================================
> --- libavformat/flic.c	(revision 12594)
> +++ libavformat/flic.c	(working copy)
> @@ -53,14 +53,26 @@
>  static int flic_probe(AVProbeData *p)
>  {
>      int magic_number;
> +    int width;
> +    int height;
>  
>      magic_number = AV_RL16(&p->buf[4]);
> +    width = AV_RL16(&p->buf[8]);
> +    height = AV_RL16(&p->buf[10]);
> +
> +    /* sanity-check the dimensions */
> +    if ((width < 4) && (width > 2048))
> +        return 0;
> +    if ((height < 4) && (height > 2048))
> +        return 0;
> +
>   

you could check width and height only after magic number too
(and there are unneeded parentheses)

>      if ((magic_number != FLIC_FILE_MAGIC_1) &&
>          (magic_number != FLIC_FILE_MAGIC_2) &&
>          (magic_number != FLIC_FILE_MAGIC_3))
>          return 0;
>  
> -    return AVPROBE_SCORE_MAX;
> +    /* never completely sure */
> +    return 9*AVPROBE_SCORE_MAX/10;
>   

-- 
Benoit Fouet
Purple Labs S.A.
www.purplelabs.com




More information about the ffmpeg-devel mailing list