avcodec/videodsp_template: Adjust pointers to avoid undefined pointer things

Fixes: subtraction of unsigned offset from 0xf6602770 overflowed to 0xf6638c80
Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-495074400600064

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 f0150cd41c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2023-01-12 00:29:02 +01:00
parent 6875531f44
commit ed78f71c6a
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 2 additions and 2 deletions

View File

@ -60,7 +60,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
av_assert2(start_x < end_x && block_w); av_assert2(start_x < end_x && block_w);
w = end_x - start_x; w = end_x - start_x;
src += start_y * src_linesize + start_x * sizeof(pixel); src += start_y * src_linesize + start_x * (ptrdiff_t)sizeof(pixel);
buf += start_x * sizeof(pixel); buf += start_x * sizeof(pixel);
// top // top
@ -83,7 +83,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
buf += buf_linesize; buf += buf_linesize;
} }
buf -= block_h * buf_linesize + start_x * sizeof(pixel); buf -= block_h * buf_linesize + start_x * (ptrdiff_t)sizeof(pixel);
while (block_h--) { while (block_h--) {
pixel *bufp = (pixel *) buf; pixel *bufp = (pixel *) buf;