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

1918583643 at qq.com 1918583643 at qq.com
Tue Nov 5 02:36:36 EET 2024


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.

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



More information about the ffmpeg-devel mailing list