aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-01-13 01:01:36 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2023-03-27 13:37:17 +0200
commit9e9360e4c8b0e3ba90a358220f59404bd3d772a8 (patch)
tree4431f7bc345135effd82b3716d6936e16d6ea59e
parent1a6f5b0ff498704a57f1d7d228b3e9d064524fd7 (diff)
downloadffmpeg-9e9360e4c8b0e3ba90a358220f59404bd3d772a8.tar.gz
avcodec/012v: Order operations for odd size handling
Fixes: out of array access Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ZERO12V_fuzzer-6714182078955520.fuzz Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ZERO12V_fuzzer-6698145212137472.fuzz Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 4d42d82563d806b5610c0c91497e24ef7f37d4cf) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/012v.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/012v.c b/libavcodec/012v.c
index 08c9938b12..95dc48c1b7 100644
--- a/libavcodec/012v.c
+++ b/libavcodec/012v.c
@@ -131,8 +131,8 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
u = x/2 + (uint16_t *)(pic->data[1] + line * pic->linesize[1]);
v = x/2 + (uint16_t *)(pic->data[2] + line * pic->linesize[2]);
memcpy(y, y_temp, sizeof(*y) * (width - x));
- memcpy(u, u_temp, sizeof(*u) * (width - x + 1) / 2);
- memcpy(v, v_temp, sizeof(*v) * (width - x + 1) / 2);
+ memcpy(u, u_temp, sizeof(*u) * ((width - x + 1) / 2));
+ memcpy(v, v_temp, sizeof(*v) * ((width - x + 1) / 2));
}
line_end += stride;