Guest User

Untitled

a guest
Jul 16th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c
  2. index 68656bc..ce35df4 100644
  3. --- a/src/video_output/vout_pictures.c
  4. +++ b/src/video_output/vout_pictures.c
  5. @@ -570,8 +570,13 @@ int __vout_AllocatePicture( vlc_object_t *p_this, picture_t
  6. }
  7.  
  8. /* Calculate how big the new image should be */
  9. - size_t i_bytes = (size_t)p_pic->format.i_bits_per_pixel *
  10. - i_width_aligned * i_height_aligned / 8;
  11. + uint64_t i_pixels = i_width_aligned * i_height_aligned;
  12. + uint64_t i_bytes = i_pixels * p_pic->format.i_bits_per_pixel / 8;
  13. + if( i_bytes > SIZE_MAX || i_bytes < i_pixels ) /* prevent overflow */
  14. + {
  15. + p_pic->i_planes = 0;
  16. + return VLC_ENOMEM;
  17. + }
  18.  
  19. p_pic->p_data = vlc_memalign( &p_pic->p_data_orig, 16, i_bytes );
Add Comment
Please, Sign In to add comment