[vlc-commits] codec: gstreamer: fix unsafe copy of video_format_t

Francois Cartegnie git at videolan.org
Mon Nov 21 21:23:03 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Nov 21 18:52:58 2016 +0100| [755578c8c50db8e0bacf59ad2bd7f8972b92178a] | committer: Francois Cartegnie

codec: gstreamer: fix unsafe copy of video_format_t

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

 modules/codec/gstreamer/gstvlcpictureplaneallocator.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/modules/codec/gstreamer/gstvlcpictureplaneallocator.c b/modules/codec/gstreamer/gstvlcpictureplaneallocator.c
index 601c3bd..8b03daf 100644
--- a/modules/codec/gstreamer/gstvlcpictureplaneallocator.c
+++ b/modules/codec/gstreamer/gstvlcpictureplaneallocator.c
@@ -327,18 +327,24 @@ bool gst_vlc_picture_plane_allocator_query_format(
     picture_t *p_pic_info = &p_allocator->pic_info;
 
     /* Back up the original format; as this is just a query  */
-    memcpy( &v_fmt, &p_dec->fmt_out.video, sizeof( video_format_t ));
+    v_fmt = p_dec->fmt_out.video;
+    video_format_Init( &p_dec->fmt_out.video, 0 );
 
-    if( !gst_vlc_video_info_from_vout( p_info, p_align, p_caps, p_dec,
+    bool b_ret =
+        gst_vlc_video_info_from_vout( p_info, p_align, p_caps, p_dec,
                 p_pic_info ))
+
+    video_format_Clean( &p_dec->fmt_out.video );
+
+    /* Restore the original format; as this was just a query  */
+    p_dec->fmt_out.video = v_fmt;
+
+    if( !b_ret )
     {
         msg_Err( p_allocator->p_dec, "failed to get the vout info" );
         return false;
     }
 
-    /* Restore the original format; as this was just a query  */
-    memcpy( &p_dec->fmt_out.video, &v_fmt, sizeof( video_format_t ));
-
     return true;
 }
 



More information about the vlc-commits mailing list