changeset 6914:224b51e2c960 libavcodec

Check dia size a little more. Fixes CID80.
author michael
date Tue, 27 May 2008 23:41:10 +0000
parents e716466d3665
children 77ce2329f620
files motion_est.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/motion_est.c	Tue May 27 22:10:17 2008 +0000
+++ b/motion_est.c	Tue May 27 23:41:10 2008 +0000
@@ -235,6 +235,12 @@
     MotionEstContext * const c= &s->me;
     int cache_size= FFMIN(ME_MAP_SIZE>>ME_MAP_SHIFT, 1<<ME_MAP_SHIFT);
     int dia_size= FFMAX(FFABS(s->avctx->dia_size)&255, FFABS(s->avctx->pre_dia_size)&255);
+
+    if(FFMIN(s->avctx->dia_size, s->avctx->pre_dia_size) < -ME_MAP_SIZE){
+        av_log(s->avctx, AV_LOG_ERROR, "ME_MAP size is too small for SAB diamond\n");
+        return -1;
+    }
+
     c->avctx= s->avctx;
 
     if(cache_size < 2*dia_size && !c->stride){