diff mbox

[FFmpeg-devel,1/2] avcodec/xan: Improve overlapping check

Message ID 20171030222141.18537-1-michael@niedermayer.cc
State Accepted
Commit e8fafef1db43ead4eae5a6301ccc300e73aa47da
Headers show

Commit Message

Michael Niedermayer Oct. 30, 2017, 10:21 p.m. UTC
Fixes: memcpy-param-overlap
Fixes: 3612/clusterfuzz-testcase-minimized-6393461273001984

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

Comments

Michael Niedermayer Nov. 1, 2017, 7:07 p.m. UTC | #1
On Mon, Oct 30, 2017 at 11:21:40PM +0100, Michael Niedermayer wrote:
> Fixes: memcpy-param-overlap
> Fixes: 3612/clusterfuzz-testcase-minimized-6393461273001984
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/xan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

patchset applied


[...]
diff mbox

Patch

diff --git a/libavcodec/xan.c b/libavcodec/xan.c
index 4c01c0013f..8b4ec82405 100644
--- a/libavcodec/xan.c
+++ b/libavcodec/xan.c
@@ -263,7 +263,7 @@  static inline void xan_wc3_copy_pixel_run(XanContext *s, AVFrame *frame,
     prevframe_index = (y + motion_y) * stride + x + motion_x;
     prevframe_x = x + motion_x;
 
-    if (prev_palette_plane == palette_plane && FFABS(curframe_index - prevframe_index) < pixel_count) {
+    if (prev_palette_plane == palette_plane && FFABS(motion_x + width*motion_y) < pixel_count) {
          avpriv_request_sample(s->avctx, "Overlapping copy");
          return ;
     }