diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2016-01-20 13:41:33 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-01-20 13:41:33 +0200 |
commit | 70db210315a5717f86598d45915271c3170d4eeb (patch) | |
tree | 1c4e924a6602f907b868f3db7b36877395cadb4d /ext | |
parent | 7eee775d5f3ee705abd7805838cd48cab1f6870a (diff) |
vp8enc: Ensure that we always have valid frame user data before using it
Otherwise we're going to dereference NULL pointers.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/vpx/gstvp8enc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/vpx/gstvp8enc.c b/ext/vpx/gstvp8enc.c index c7bca12ef..d5f06824b 100644 --- a/ext/vpx/gstvp8enc.c +++ b/ext/vpx/gstvp8enc.c @@ -289,7 +289,14 @@ gst_vp8_enc_process_frame_user_data (GstVPXEnc * enc, GstVideoCodecFrame * frame) { GstVP8EncUserData *user_data; + user_data = gst_video_codec_frame_get_user_data (frame); + + if (!user_data) { + GST_ERROR_OBJECT (enc, "Have no frame user data"); + return NULL; + } + if (user_data->image) g_slice_free (vpx_image_t, user_data->image); user_data->image = NULL; @@ -301,7 +308,14 @@ gst_vp8_enc_handle_invisible_frame_buffer (GstVPXEnc * enc, void *user_data, GstBuffer * buffer) { GstVP8EncUserData *vp8_user_data = (GstVP8EncUserData *) user_data; + + if (!vp8_user_data) { + GST_ERROR_OBJECT (enc, "Have no frame user data"); + return GST_FLOW_ERROR; + } + vp8_user_data->invisible = g_list_append (vp8_user_data->invisible, buffer); + return GST_FLOW_OK; } |