[vlc-devel] [PATCH 3/3] Fixed implicit conversion from int to ulong

Rémi Denis-Courmont remi at remlab.net
Sun Mar 1 09:11:51 CET 2015


Le dimanche 01 mars 2015, 03:02:23 Ian Chamberlain a écrit :
> This explicitly casts to unsigned long to avoid the warning.
> ---
>  src/video_output/snapshot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/video_output/snapshot.c b/src/video_output/snapshot.c
> index c8096ef..d9c3fe5 100644
> --- a/src/video_output/snapshot.c
> +++ b/src/video_output/snapshot.c
> @@ -191,7 +191,7 @@ int vout_snapshot_SaveImage(char **name, int
> *sequential, strcpy(buffer, "error");
> 
>              if (asprintf(&filename, "%s" DIR_SEP "%s%s%03lu.%s",
> -                         cfg->path, prefix, buffer, tv.tv_usec / 1000,
> +                         cfg->path, prefix, buffer, tv.tv_usec / (unsigned
> long) 1000, cfg->format) < 0)

tv_usec is suseconds_t, not unsigned long. So it's still potentially UB.

>                  filename = NULL;
>          }

-- 
Rémi Denis-Courmont
http://www.remlab.net/




More information about the vlc-devel mailing list