[FFmpeg-devel] [PATCH] avutil/timecode: fix sscanf format string with garbage at the end

lance.lmwang at gmail.com lance.lmwang at gmail.com
Sat Jun 20 18:51:00 EEST 2020


On Sat, Jun 20, 2020 at 05:35:23PM +0200, Nicolas George wrote:
> lance.lmwang at gmail.com (12020-06-20):
> > From: Limin Wang <lance.lmwang at gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> > ---
> >  libavutil/timecode.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> I doubt this was actually tested.
I'm testing with below test.c, maybe I'm not catch what's your garbage in the
end. Please give one example for your str?

 lmwang at MacBook-Pro  ~  gcc -o test test.c
 lmwang at MacBook-Pro  ~  ./test
hh: 10, mm: 11, ss: 40, ff: 14
 lmwang at MacBook-Pro  ~  cat test.c
#include <string.h>
#include <stdio.h>

int main()
{
    char c;
    int hh, mm, ss, ff, ret;
    char *str = "10:11:40:14444d";

    if (sscanf(str, "%02u:%02u:%02u%c%02u", &hh, &mm, &ss, &c, &ff) != 5) {
        printf( "failed \n");
    }
    printf( "hh: %d, mm: %d, ss: %d, ff: %d \n", hh, mm, ss, ff);
}

> 
> Regards,
> 
> -- 
>   Nicolas George



-- 
Thanks,
Limin Wang


More information about the ffmpeg-devel mailing list