[FFmpeg-devel] [PATCH] Fix gif decoder max option

James Almer jamrial at gmail.com
Tue Sep 17 04:10:49 EEST 2019


On 9/16/2019 10:05 PM, Soft Works wrote:
> An int32 option cannot have a maximum of UINT32_MAX

AV_OPT_TYPE_INT options are int64_t. In this case however the storage
type for trans_color in GifState is int.

Reading the code i see it's intended to be uint32_t, so i think the
correct fix is changing its storage type, and not limiting its allowed
range. Same with stored_bg_color.

> 
> Before this patch
>   -trans_color       <int>        .D.V..... color value (ARGB) that is used instead of transparent color (from 0 to UINT32_MAX)
> 
> Afterwards:
>   -trans_color       <int>        .D.V..... color value (ARGB) that is used instead of transparent color (from 0 to INT_MAX)
> Signed-off-by: softworkz <softworkz at hotmail.com>
> ---
>  libavcodec/gifdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c
> index 1906a4c738..4c5246c3d4 100644
> --- a/libavcodec/gifdec.c
> +++ b/libavcodec/gifdec.c
> @@ -546,7 +546,7 @@ static av_cold int gif_decode_close(AVCodecContext *avctx)
>  static const AVOption options[] = {
>      { "trans_color", "color value (ARGB) that is used instead of transparent color",
>        offsetof(GifState, trans_color), AV_OPT_TYPE_INT,
> -      {.i64 = GIF_TRANSPARENT_COLOR}, 0, 0xffffffff,
> +      {.i64 = GIF_TRANSPARENT_COLOR}, 0, INT_MAX,
>        AV_OPT_FLAG_DECODING_PARAM|AV_OPT_FLAG_VIDEO_PARAM },
>      { NULL },
>  };
> 



More information about the ffmpeg-devel mailing list