mpegvideo: Avoid 32-bit wrapping of linesize multiplications
authorMartin Storsjö <martin@martin.st>
Tue, 3 Sep 2013 22:36:51 +0000 (01:36 +0300)
committerMartin Storsjö <martin@martin.st>
Wed, 4 Sep 2013 11:33:29 +0000 (14:33 +0300)
This makes sure that linesize * start_y doesn't overflow, so that
emulated_edge_mc can get back the original value if needed.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/mpegvideo_motion.c

index c8109b1..cbf200f 100644 (file)
@@ -217,7 +217,8 @@ void mpeg_motion_internal(MpegEncContext *s,
 {
     uint8_t *ptr_y, *ptr_cb, *ptr_cr;
     int dxy, uvdxy, mx, my, src_x, src_y,
-        uvsrc_x, uvsrc_y, v_edge_pos, uvlinesize, linesize;
+        uvsrc_x, uvsrc_y, v_edge_pos;
+    ptrdiff_t uvlinesize, linesize;
 
 #if 0
 if(s->quarter_sample)