changeset 4097:de30c06dc299 libavcodec

prevent overflow if lambda2 is "too" large
author michael
date Sat, 28 Oct 2006 15:20:00 +0000
parents 99616a74260a
children db808f95ad06
files mpegvideo.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mpegvideo.c	Sat Oct 28 11:15:06 2006 +0000
+++ b/mpegvideo.c	Sat Oct 28 15:20:00 2006 +0000
@@ -5579,7 +5579,7 @@
     /* Estimate motion for every MB */
     if(s->pict_type != I_TYPE){
         s->lambda = (s->lambda * s->avctx->me_penalty_compensation + 128)>>8;
-        s->lambda2= (s->lambda2* s->avctx->me_penalty_compensation + 128)>>8;
+        s->lambda2= (s->lambda2* (int64_t)s->avctx->me_penalty_compensation + 128)>>8;
         if(s->pict_type != B_TYPE && s->avctx->me_threshold==0){
             if((s->avctx->pre_me && s->last_non_b_pict_type==I_TYPE) || s->avctx->pre_me==2){
                 s->avctx->execute(s->avctx, pre_estimate_motion_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count);