[FFmpeg-cvslog] avutil/frame: use size_t for total_size in get_video_buffer()

James Almer git at videolan.org
Fri Nov 22 16:13:30 EET 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sat Nov 16 13:10:24 2024 -0300| [09122bd15c87ee9900f61639e9b2e233c5ffaade] | committer: James Almer

avutil/frame: use size_t for total_size in get_video_buffer()

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=09122bd15c87ee9900f61639e9b2e233c5ffaade
---

 libavutil/frame.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index f0a0dba018..f42f310023 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -173,10 +173,10 @@ void av_frame_free(AVFrame **frame)
 static int get_video_buffer(AVFrame *frame, int align)
 {
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
-    int ret, padded_height, total_size;
+    int ret, padded_height;
     int plane_padding = FFMAX(16 + 16/*STRIDE_ALIGN*/, align);
     ptrdiff_t linesizes[4];
-    size_t sizes[4];
+    size_t total_size, sizes[4];
 
     if (!desc)
         return AVERROR(EINVAL);
@@ -211,7 +211,7 @@ static int get_video_buffer(AVFrame *frame, int align)
 
     total_size = 4*plane_padding;
     for (int i = 0; i < 4; i++) {
-        if (sizes[i] > INT_MAX - total_size)
+        if (sizes[i] > SIZE_MAX - total_size)
             return AVERROR(EINVAL);
         total_size += sizes[i];
     }



More information about the ffmpeg-cvslog mailing list