Fix for overflow issue in mpegvideo.c patch by (Martin Boehme: boehme, inb uni-luebec...
authorMartin Boehme <boehme@inb.uni-luebeck.de>
Mon, 25 Jul 2005 23:07:27 +0000 (23:07 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 25 Jul 2005 23:07:27 +0000 (23:07 +0000)
this integer overflow might lead to the execution of arbitrary code during encoding with threads

Originally committed as revision 4474 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/mpegvideo.c

index a601713..87a56ff 100644 (file)
@@ -2316,8 +2316,8 @@ int MPV_encode_picture(AVCodecContext *avctx,
         int start_y= s->thread_context[i]->start_mb_y;
         int   end_y= s->thread_context[i]->  end_mb_y;
         int h= s->mb_height;
-        uint8_t *start= buf + buf_size*start_y/h;
-        uint8_t *end  = buf + buf_size*  end_y/h;
+        uint8_t *start= buf + (size_t)(((int64_t) buf_size)*start_y/h);
+        uint8_t *end  = buf + (size_t)(((int64_t) buf_size)*  end_y/h);
 
         init_put_bits(&s->thread_context[i]->pb, start, end - start);
     }