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 <ceho...@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.
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel