[vlc-devel] commit: Fix integer overflow in picture size calculation ( Rafaël Carré )

git version control git at videolan.org
Fri Oct 30 09:36:53 CET 2009


vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Fri Oct 30 09:36:09 2009 +0100| [33f12f759f925d206fa4ec2001db57d1133c11a6] | committer: Rafaël Carré 

Fix integer overflow in picture size calculation

Closes #2885

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=33f12f759f925d206fa4ec2001db57d1133c11a6
---

 src/video_output/vout_pictures.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c
index 9429ac7..68656bc 100644
--- a/src/video_output/vout_pictures.c
+++ b/src/video_output/vout_pictures.c
@@ -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 );




More information about the vlc-devel mailing list