[FFmpeg-devel] [PATCH]Auto-detection for concat demuxer

Nicolas George nicolas.george at normalesup.org
Sun Feb 3 09:21:31 CET 2013


Le quintidi 15 pluviôse, an CCXXI, Carl Eugen Hoyos a écrit :
> Hi!
> 
> Attached patch adds auto-detection for the concat demuxer.
> 
> Please review, Carl Eugen

Thanks, but I am afraid this may be a security concern: allowing a foreign
file to redirect to any file in the system may expose sensitive information,
or worse. I had plans to allow probing of ffconcat scripts, I started
working on them just now since there is demand.

> diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
> index 0514755..9e73824 100644
> --- a/libavformat/concatdec.c
> +++ b/libavformat/concatdec.c
> @@ -37,7 +37,21 @@ typedef struct {
>  
>  static int concat_probe(AVProbeData *probe)
>  {
> -    return 0;
> +    const char *buf = probe->buf;
> +    const char *end = buf + probe->buf_size;
> +    int found = 0;
> +
> +    while (buf + 6 < end) {
> +        if (!strncmp(buf, "file ", 5)) {
> +            found++;
> +            buf += 5;
> +        } else if (*buf != '#') {
> +            return 0;
> +        }
> +        while (buf < end && *buf++ != '\n')
> +            ;
> +    }

> +    return found ? AVPROBE_SCORE_MAX : 0;

I find that SCORE_MAX for just a line that starts with "file" and a space is
a bit too much.

>  }
>  
>  static char *get_keyword(uint8_t **cursor)

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130203/0de5bbe0/attachment.asc>


More information about the ffmpeg-devel mailing list