mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-29 22:00:58 +02:00
mpegvideo_motion: Handle edge emulation even without unrestricted_mv
Fix out of bounds read. Bug-Id: 962 Found by: F4B3CD@STARLAB and Agostino Sarubbo Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
This commit is contained in:
parent
15fcf6292e
commit
136f552075
@ -210,17 +210,14 @@ static inline int hpel_motion(MpegEncContext *s,
|
||||
dxy |= (motion_y & 1) << 1;
|
||||
src += src_y * s->linesize + src_x;
|
||||
|
||||
if (s->unrestricted_mv) {
|
||||
if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 1) - 8, 0) ||
|
||||
(unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y & 1) - 8, 0)) {
|
||||
s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, src,
|
||||
s->linesize, s->linesize,
|
||||
9, 9,
|
||||
src_x, src_y, s->h_edge_pos,
|
||||
s->v_edge_pos);
|
||||
src = s->sc.edge_emu_buffer;
|
||||
emu = 1;
|
||||
}
|
||||
if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 1) - 8, 0) ||
|
||||
(unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y & 1) - 8, 0)) {
|
||||
s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, src,
|
||||
s->linesize, s->linesize,
|
||||
9, 9, src_x, src_y,
|
||||
s->h_edge_pos, s->v_edge_pos);
|
||||
src = s->sc.edge_emu_buffer;
|
||||
emu = 1;
|
||||
}
|
||||
pix_op[dxy](dest, src, s->linesize, 8);
|
||||
return emu;
|
||||
|
Loading…
x
Reference in New Issue
Block a user