aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dsputil_template.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-16 20:57:35 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-16 21:33:52 +0100
commit2207ea44fb4fad4d47646a789bc244e3e84c1726 (patch)
tree3c9972561e594002fcb37b87a6e42c86af5b2340 /libavcodec/dsputil_template.c
parent7750c48d30405a7682e44b68ac46bd9b59200229 (diff)
downloadandroid_external_ffmpeg-2207ea44fb4fad4d47646a789bc244e3e84c1726.tar.gz
android_external_ffmpeg-2207ea44fb4fad4d47646a789bc244e3e84c1726.tar.bz2
android_external_ffmpeg-2207ea44fb4fad4d47646a789bc244e3e84c1726.zip
ff_emulated_edge_mc: fix integer anomalies, fix out of array reads
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dsputil_template.c')
-rw-r--r--libavcodec/dsputil_template.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/dsputil_template.c b/libavcodec/dsputil_template.c
index 0d6e8df313..eacf59bd56 100644
--- a/libavcodec/dsputil_template.c
+++ b/libavcodec/dsputil_template.c
@@ -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;
if(src_y>= h){
- src+= (h-1-src_y)*linesize;
+ src-= src_y*linesize;
+ src+= (h-1)*linesize;
src_y=h-1;
}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;
}
if(src_x>= w){