aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-06-09 22:36:00 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2022-10-09 21:32:54 +0200
commitd40c8b42026fb2ab01cc66bc3dfad7463f018c60 (patch)
treeb32650711ba4e199196d80d3300e8686f4b5430d
parent4aeea332ebf87cb3bb77a053516e49b082d75c4e (diff)
downloadffmpeg-d40c8b42026fb2ab01cc66bc3dfad7463f018c60.tar.gz
avcodec/cdgraphics: limit scrolling to the line
Fixes: out of array access Fixes: 47877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDGRAPHICS_fuzzer-5690504626438144 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit b7e30a13d4e4557b87f977b76a6bb5e3cbe5ac78) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/cdgraphics.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c
index cf3f01a417..1341669a34 100644
--- a/libavcodec/cdgraphics.c
+++ b/libavcodec/cdgraphics.c
@@ -239,7 +239,7 @@ static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data,
for (y = FFMAX(0, vinc); y < FFMIN(CDG_FULL_HEIGHT + vinc, CDG_FULL_HEIGHT); y++)
memcpy(out + FFMAX(0, hinc) + stride * y,
in + FFMAX(0, hinc) - hinc + (y - vinc) * stride,
- FFMIN(stride + hinc, stride));
+ FFABS(stride) - FFABS(hinc));
if (vinc > 0)
cdg_fill_wrapper(0, 0, out,