[FFmpeg-devel] [PATCH] avformat/gifdec: There is an overflow int64_t receiving with int

Zhao Zhili quinkblack at foxmail.com
Tue Nov 5 05:29:17 EET 2024



> On Nov 5, 2024, at 08:36, wzq via ffmpeg-devel <ffmpeg-devel at ffmpeg.org> wrote:
> 
> From: wzqzero <1918583643 at qq.com>
> 
> When converting a two-minute 3840 x 2160 video to a GIF file,
> the viewing duration is shorter than the source duration when you use ffmpeg -i,
> which is due to data overflow,
> which causes positive numbers to become negative after being assigned,
> causing the gif_skip_subblocks to fail.

LGTM, although I’m shocked by 4K gif usecase.

> 
> Signed-off-by: wzqzero <1918583643 at qq.com>
> ---
> libavformat/gifdec.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/gifdec.c b/libavformat/gifdec.c
> index d5f06adc64..b026fa34ea 100644
> --- a/libavformat/gifdec.c
> +++ b/libavformat/gifdec.c
> @@ -99,9 +99,9 @@ static int resync(AVIOContext *pb)
>     return 0;
> }
> 
> -static int gif_skip_subblocks(AVIOContext *pb)
> +static int64_t gif_skip_subblocks(AVIOContext *pb)
> {
> -    int sb_size, ret = 0;
> +    int64_t sb_size, ret = 0;
> 
>     while (0x00 != (sb_size = avio_r8(pb))) {
>         if ((ret = avio_skip(pb, sb_size)) < 0)
> -- 
> 2.43.0.windows.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list