summaryrefslogtreecommitdiff
path: root/libavcodec/motion_est.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-05-27 23:41:10 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-05-27 23:41:10 +0000
commit540c5220ffafce9038b1f0c96cb02382d0ab126e (patch)
treefeb2ed5c1a006b43910a44b747bc5dcf5fa76851 /libavcodec/motion_est.c
parentaa7205bcf1688b6f35f2391441732a9ccbf0f019 (diff)
Check dia size a little more. Fixes CID80.
Originally committed as revision 13481 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/motion_est.c')
-rw-r--r--libavcodec/motion_est.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 54bc93da38..b97b441305 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -235,6 +235,12 @@ void ff_init_me(MpegEncContext *s){
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){