Commit 19b41f86 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/mjpegdec: use the correct linesize in the flipping code

Fixes out of array access
No releases should be affected
Depends on 7c3700cd, do not backport without this one

Fixes: asan_heap-oob_14a37fe_9111_cov_1692584941_test4.amv
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent f58eab15
......@@ -2052,12 +2052,12 @@ the_end:
h = FF_CEIL_RSHIFT(h, vshift);
}
if(dst){
uint8_t *dst2 = dst + s->linesize[index]*(h-1);
uint8_t *dst2 = dst + s->picture_ptr->linesize[index]*(h-1);
for (i=0; i<h/2; i++) {
for (j=0; j<w; j++)
FFSWAP(int, dst[j], dst2[j]);
dst += s->linesize[index];
dst2 -= s->linesize[index];
dst += s->picture_ptr->linesize[index];
dst2 -= s->picture_ptr->linesize[index];
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment