mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-24 02:09:03 +03:00
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
This commit is contained in:
committed by
michaelni
parent
341553de8a
commit
f07f02abb8
@@ -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)),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user