From 4f5aceaa5a670a92e91a8db9740ec19909024ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 7 Jun 2020 14:50:21 +0300 Subject: [PATCH] video: Check that the passed in video info is valid when creating a VideoFrame --- gstreamer-video/src/video_frame.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gstreamer-video/src/video_frame.rs b/gstreamer-video/src/video_frame.rs index 76cd145e9..a32462e21 100644 --- a/gstreamer-video/src/video_frame.rs +++ b/gstreamer-video/src/video_frame.rs @@ -224,6 +224,8 @@ impl VideoFrame { ) -> Result, gst::Buffer> { skip_assert_initialized!(); + assert!(info.is_valid()); + unsafe { let mut frame = mem::MaybeUninit::zeroed(); let res: bool = from_glib(gst_video_sys::gst_video_frame_map( @@ -255,6 +257,8 @@ impl VideoFrame { ) -> Result, gst::Buffer> { skip_assert_initialized!(); + assert!(info.is_valid()); + unsafe { let mut frame = mem::MaybeUninit::zeroed(); let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id( @@ -288,6 +292,8 @@ impl VideoFrame { ) -> Result, gst::Buffer> { skip_assert_initialized!(); + assert!(info.is_valid()); + unsafe { let mut frame = mem::MaybeUninit::zeroed(); let res: bool = from_glib(gst_video_sys::gst_video_frame_map( @@ -321,6 +327,8 @@ impl VideoFrame { ) -> Result, gst::Buffer> { skip_assert_initialized!(); + assert!(info.is_valid()); + unsafe { let mut frame = mem::MaybeUninit::zeroed(); let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id( @@ -572,6 +580,8 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { ) -> Result, glib::BoolError> { skip_assert_initialized!(); + assert!(info.is_valid()); + unsafe { let mut frame = mem::MaybeUninit::zeroed(); let res: bool = from_glib(gst_video_sys::gst_video_frame_map( @@ -602,6 +612,8 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> { ) -> Result, glib::BoolError> { skip_assert_initialized!(); + assert!(info.is_valid()); + unsafe { let mut frame = mem::MaybeUninit::zeroed(); let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id( @@ -661,6 +673,8 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { ) -> Result, glib::BoolError> { skip_assert_initialized!(); + assert!(info.is_valid()); + unsafe { let mut frame = mem::MaybeUninit::zeroed(); let res: bool = from_glib(gst_video_sys::gst_video_frame_map( @@ -693,6 +707,8 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> { ) -> Result, glib::BoolError> { skip_assert_initialized!(); + assert!(info.is_valid()); + unsafe { let mut frame = mem::MaybeUninit::zeroed(); let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id(