[FFmpeg-devel] [PATCH 2/3] avcodec/hevcdec: do not memcpy into itself

Michael Niedermayer michael at niedermayer.cc
Thu Apr 27 21:38:39 EEST 2023


Iam not sure if this buffer setup is intended but if it occurs memcpy() cannot always
be used

Fixes: memcpy-param-overlap
Fixes: 58062/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4717458841010176

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/hevcdec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 0fa4fdd59d..1e590ec5d0 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -1542,6 +1542,7 @@ static void luma_mc_uni(HEVCLocalContext *lc, uint8_t *dst, ptrdiff_t dststride,
     src   += y_off * srcstride + (x_off * (1 << s->ps.sps->pixel_shift));
 
     if (x_off < QPEL_EXTRA_BEFORE || y_off < QPEL_EXTRA_AFTER ||
+        s->frame->data[0] == ref->data[0] ||
         x_off >= pic_width - block_w - QPEL_EXTRA_AFTER ||
         y_off >= pic_height - block_h - QPEL_EXTRA_AFTER) {
         const ptrdiff_t edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift;
-- 
2.17.1



More information about the ffmpeg-devel mailing list