]> git.sesse.net Git - vlc/commitdiff
Fix integer overflow in picture size calculation
authorRafaël Carré <rafael.carre@gmail.com>
Fri, 30 Oct 2009 08:36:09 +0000 (09:36 +0100)
committerRafaël Carré <rafael.carre@gmail.com>
Fri, 30 Oct 2009 08:36:42 +0000 (09:36 +0100)
Closes #2885

src/video_output/vout_pictures.c

index 9429ac79c015ccde41cdec0095ea8827538bf530..68656bc1e785be947c4cc6fed58b2b3a7a42683b 100644 (file)
@@ -556,7 +556,7 @@ int __vout_AllocatePicture( vlc_object_t *p_this, picture_t *p_pic,
                             int i_width, int i_height, int i_aspect )
 {
     VLC_UNUSED(p_this);
-    int i_bytes, i_index, i_width_aligned, i_height_aligned;
+    int i_index, i_width_aligned, i_height_aligned;
 
     /* Make sure the real dimensions are a multiple of 16 */
     i_width_aligned = (i_width + 15) >> 4 << 4;
@@ -570,7 +570,7 @@ int __vout_AllocatePicture( vlc_object_t *p_this, picture_t *p_pic,
     }
 
     /* Calculate how big the new image should be */
-    i_bytes = p_pic->format.i_bits_per_pixel *
+    size_t i_bytes = (size_t)p_pic->format.i_bits_per_pixel *
         i_width_aligned * i_height_aligned / 8;
 
     p_pic->p_data = vlc_memalign( &p_pic->p_data_orig, 16, i_bytes );