This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit f07f02abb864de022b973220e46ef24d203d8bbd
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Mon Oct 12 02:48:35 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Tue Oct 20 02:25:09 2026 +0000

    avutil/hwcontext_cuda: copy only the bytes of the visible rows
    
    Fixes: out of array access
    Fixes: ZqshmgSdN2Q2
    Found during triage of the review of 
https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24595
    Out of array read and write Replicated through API with ASAN
    Out of array read Replicated through UnModified FFmpeg with a guard page 
allocator
---
 libavutil/hwcontext_cuda.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c
index 0ee6bb4945..776c321652 100644
--- a/libavutil/hwcontext_cuda.c
+++ b/libavutil/hwcontext_cuda.c
@@ -567,10 +567,16 @@ static int cuda_transfer_data(AVHWFramesContext *ctx, 
AVFrame *dst,
         int src_is_nonplanar_cuarray = 0;
         int dst_is_nonplanar_cuarray = 0;
 
+        int bytewidth = av_image_get_linesize(ctx->sw_format, src->width, i);
+        if (bytewidth < 0) {
+            ret = bytewidth;
+            goto fail;
+        }
+
         CUDA_MEMCPY2D cpy = {
             .srcPitch      = src->linesize[i],
             .dstPitch      = dst->linesize[i],
-            .WidthInBytes  = FFMIN(src->linesize[i], dst->linesize[i]),
+            .WidthInBytes  = bytewidth,
             .Height        = AV_CEIL_RSHIFT(src->height, ((i == 0 || i == 3) ? 
0 : priv->shift_height)),
         };
 

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to