GNOME Bugzilla – Bug 788838
GstQueueArray: add function guards to avoid NULL queue pointer
Last modified: 2017-10-16 11:26:05 UTC
In File : gstqueuearray.c Function : gboolean gst_queue_array_is_empty (GstQueueArray * array) Line No. 320 There is a possibility of crash if array is null, due to dereferencing of null pointer. gboolean gst_queue_array_is_empty (GstQueueArray * array) { return (array->length == 0); } ---------------- Submitting patch with null pointer check.
Created attachment 361342 [details] [review] [PATCH]Possible crash due to dereferencing a null pointer in gst_queue_array_is_empty Please review and share the feedback.
Review of attachment 361342 [details] [review]: ::: gstreamer-1.12.3_org/libs/gst/base/gstqueuearray.c @@ +318,3 @@ gst_queue_array_is_empty (GstQueueArray * array) { + return (!array || array->length == 0); It's a programming error to pass NULL here. Use "g_return_val_if_fail (array != NULL, FALSE);"
Created attachment 361396 [details] [review] [PATCH]Possible crash due to dereferencing a null pointer in gst_queue_array_is_empty Patch updated as per review comments.
Comment on attachment 361396 [details] [review] [PATCH]Possible crash due to dereferencing a null pointer in gst_queue_array_is_empty Looks good now but please submit the patch with a proper commit message, and please also check if similar guards are missing from other public GstQueueArray API. See https://gstreamer.freedesktop.org/documentation/contribute/#how-to-submit-patches for details about how the commit message should look like.
Created attachment 361484 [details] [review] [PATCH] Gstreamer: Fix for possible crash due to null pointer Commit message improved in the patch.
*** Bug 788928 has been marked as a duplicate of this bug. ***
*** Bug 788929 has been marked as a duplicate of this bug. ***
Created attachment 361505 [details] [review] Gstreamer: Fix for possible crashes due to null pointer dereferencing in public GstQueueArray APIs Attached the consolidated patch for all the fixes. Please review and share your feedback.
Review of attachment 361505 [details] [review]: ::: gstreamer-1.12.3/libs/gst/base/gstqueuearray.c @@ +220,3 @@ gst_queue_array_do_expand (GstQueueArray * array) { + g_return_if_fail (array != NULL); This is an internal function. Only add these guards to public functions
Created attachment 361658 [details] [review] [PATCH] Gstreamer: Fix for possible crashes due to null pointer dereferencing in public GstQueueArray APIs Review comments implemented.
commit 250d3e728444f468c8f8fb2344d053865ce7e95d (HEAD -> master) Author: Ashish Kumar <kr.ashish@samsung.com> Date: Mon Oct 16 16:06:37 2017 +0530 queuearray: Fix for possible crashes due to null pointer dereferencing https://bugzilla.gnome.org/show_bug.cgi?id=788838