k is always 4 here and it seems this is not what was intended
replacing it with 0 works but it may be wrong

This needs review

Fixes: out of array read
Fixes: 
409593384/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SANM_fuzzer-6488251907244032

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

diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index 00bfef00fe8..ec429e1a002 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -734,7 +734,7 @@ static int old_codec4(SANMVideoContext *ctx, GetByteContext 
*gb, int top, int le
             }
 
             /* smooth top and left block borders with neighbours */
-            if (((pxoff - p + k) < 0) || ((pxoff - p + k) >= maxpxo)
+            if (((pxoff - p + 0) < 0) || ((pxoff - p + k) >= maxpxo)
                 || ((pxoff + 3 * p) < 0) || ((pxoff + 3 * p) >= maxpxo)
                 || (i == 0) || (j == 0))
                 continue;
-- 
2.49.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to