Commit 2207ea44 authored by Michael Niedermayer's avatar Michael Niedermayer

ff_emulated_edge_mc: fix integer anomalies, fix out of array reads

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 7750c48d
...@@ -131,10 +131,12 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, int linesize, i ...@@ -131,10 +131,12 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, int linesize, i
int start_y, start_x, end_y, end_x; int start_y, start_x, end_y, end_x;
if(src_y>= h){ if(src_y>= h){
src+= (h-1-src_y)*linesize; src-= src_y*linesize;
src+= (h-1)*linesize;
src_y=h-1; src_y=h-1;
}else if(src_y<=-block_h){ }else if(src_y<=-block_h){
src+= (1-block_h-src_y)*linesize; src-= src_y*linesize;
src+= (1-block_h)*linesize;
src_y=1-block_h; src_y=1-block_h;
} }
if(src_x>= w){ if(src_x>= w){
......
...@@ -1878,10 +1878,12 @@ static av_always_inline void emulated_edge_mc(uint8_t *buf, const uint8_t *src, ...@@ -1878,10 +1878,12 @@ static av_always_inline void emulated_edge_mc(uint8_t *buf, const uint8_t *src,
int start_y, start_x, end_y, end_x, src_y_add = 0; int start_y, start_x, end_y, end_x, src_y_add = 0;
if (src_y >= h) { if (src_y >= h) {
src_y_add = h - 1 - src_y; src -= src_y*linesize;
src_y_add = h - 1;
src_y = h - 1; src_y = h - 1;
} else if (src_y <= -block_h) { } else if (src_y <= -block_h) {
src_y_add = 1 - block_h - src_y; src -= src_y*linesize;
src_y_add = 1 - block_h;
src_y = 1 - block_h; src_y = 1 - block_h;
} }
if (src_x >= w) { if (src_x >= w) {
......
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