[FFmpeg-devel] [PATCH]lavf/vplayerdec: Stricter probing
Clément Bœsch
u at pkh.me
Tue Jul 12 14:34:01 EEST 2016
On Tue, Jul 12, 2016 at 12:37:39PM +0200, Carl Eugen Hoyos wrote:
> Hi!
>
> A user provided a rawvideo frame that is detected as vplayer without attached
> patch.
>
can you show a hex dump of the first few bytes?
> Please comment, Carl Eugen
> From 493f24f3d0ba74353ed7742c34a3727c344535eb Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <cehoyos at ag.or.at>
> Date: Tue, 12 Jul 2016 12:23:58 +0200
> Subject: [PATCH] lavf/vplayerdec: Stricter probing.
>
> ---
> libavformat/vplayerdec.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/vplayerdec.c b/libavformat/vplayerdec.c
> index 897c408..c530a47 100644
> --- a/libavformat/vplayerdec.c
> +++ b/libavformat/vplayerdec.c
> @@ -34,10 +34,16 @@ typedef struct {
> static int vplayer_probe(AVProbeData *p)
> {
> char c;
> + unsigned hh, mm, ss, ms = 0;
we've had surprises with negative timestamps (which can happen), so i
wouldn't make these unsigned (also, you're using signed format string
code)
> const unsigned char *ptr = p->buf;
>
> - if ((sscanf(ptr, "%*d:%*d:%*d.%*d%c", &c) == 1 ||
> - sscanf(ptr, "%*d:%*d:%*d%c", &c) == 1) && strchr(": =", c))
> + if ( (sscanf(ptr, "%d:%d:%d.%d%c", &hh, &mm, &ss, &ms, &c) == 5 ||
> + sscanf(ptr, "%d:%d:%d%c", &hh, &mm, &ss, &c) == 4)
> + && strchr(": =", c)
> + && hh < 1000
> + && mm < 60
> + && ss < 60
> + && ms < 1000)
potentially simpler alternative: if you replace the original formats with
"%*3d:%*2d:%*2d.%*2d%c" and "%*3d:%*2d:%*2d%c", does it work?
otherwise I guess patch is fine
> return AVPROBE_SCORE_MAX;
> return 0;
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160712/073bd042/attachment.sig>
More information about the ffmpeg-devel
mailing list