From 33f12f759f925d206fa4ec2001db57d1133c11a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Fri, 30 Oct 2009 09:36:09 +0100 Subject: [PATCH] Fix integer overflow in picture size calculation Closes #2885 --- src/video_output/vout_pictures.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c index 9429ac79c0..68656bc1e7 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 ); -- 2.39.5