[FFmpeg-cvslog] avcodec/dxvenc: Clear width to linesize not linesize to linesize
Michael Niedermayer
git at videolan.org
Mon Jul 28 20:06:27 EEST 2025
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Jul 23 21:25:37 2025 +0200| [a45755e302baf56461bd7d8cf0c3a88c0ee5e83f] | committer: Michael Niedermayer
avcodec/dxvenc: Clear width to linesize not linesize to linesize
Fixes: use of uninitialized memory
Fixes: 422217206/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-4786889444098048
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a45755e302baf56461bd7d8cf0c3a88c0ee5e83f
---
libavcodec/dxvenc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
index f5cef4f2e1..0a2dd8077b 100644
--- a/libavcodec/dxvenc.c
+++ b/libavcodec/dxvenc.c
@@ -197,8 +197,9 @@ static int dxv_encode(AVCodecContext *avctx, AVPacket *pkt,
avctx->height);
if (avctx->width != DXV_ALIGN(avctx->width)) {
+ av_assert0(frame->format == AV_PIX_FMT_RGBA);
for (int y = 0; y < avctx->height; y++) {
- memset(safe_data[0] + y * safe_linesize[0] + frame->linesize[0], 0, safe_linesize[0] - frame->linesize[0]);
+ memset(safe_data[0] + y * safe_linesize[0] + 4*avctx->width, 0, safe_linesize[0] - 4*avctx->width);
}
}
if (avctx->height != DXV_ALIGN(avctx->height)) {
More information about the ffmpeg-cvslog
mailing list