[FFmpeg-cvslog] ff_emulated_edge_mc: fix handling of w/h being 0

Michael Niedermayer git at videolan.org
Wed Dec 5 03:46:08 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Dec  5 03:14:03 2012 +0100| [599ae9995f2e66803431e9d87fab2e650f23229e] | committer: Michael Niedermayer

ff_emulated_edge_mc: fix handling of w/h being 0

Fixes assertion failure

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=599ae9995f2e66803431e9d87fab2e650f23229e
---

 libavcodec/dsputil_template.c |    3 +++
 libavcodec/x86/dsputil_mmx.c  |    3 +++
 2 files changed, 6 insertions(+)

diff --git a/libavcodec/dsputil_template.c b/libavcodec/dsputil_template.c
index eacf59b..2d29cd0 100644
--- a/libavcodec/dsputil_template.c
+++ b/libavcodec/dsputil_template.c
@@ -130,6 +130,9 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, int linesize, i
     int x, y;
     int start_y, start_x, end_y, end_x;
 
+    if(!w || !h)
+        return;
+
     if(src_y>= h){
         src-= src_y*linesize;
         src+= (h-1)*linesize;
diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index 3fb9d21..e722d8a 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -1675,6 +1675,9 @@ 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;
 
+    if(!w || !h)
+        return;
+
     if (src_y >= h) {
         src -= src_y*linesize;
         src_y_add = h - 1;



More information about the ffmpeg-cvslog mailing list