]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/xan: Improve overlapping check
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 30 Oct 2017 22:21:40 +0000 (23:21 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 1 Nov 2017 21:11:10 +0000 (22:11 +0100)
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

index 4c01c0013fd8d8b13843752c801eb06a7885f54f..8b4ec82405c0790c13d90b92a4eee90adf1bc1fc 100644 (file)
@@ -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 ;
     }