After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 768450 - pad: check caps not NULL before referring
pad: check caps not NULL before referring
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.8.2
Other Linux
: Normal normal
: 1.8.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-07-05 14:53 UTC by Miguel París Díaz
Modified: 2016-07-25 10:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
pad: check caps not NULL before referring (808 bytes, patch)
2016-07-05 14:55 UTC, Miguel París Díaz
none Details | Review
pad: check query caps answered and caps not NULL (1.25 KB, patch)
2016-07-05 17:19 UTC, Miguel París Díaz
none Details | Review
pad: check query caps answered and caps not NULL (1.14 KB, patch)
2016-07-06 08:37 UTC, Miguel París Díaz
committed Details | Review

Description Miguel París Díaz 2016-07-05 14:53:22 UTC
We have to check that caps are not NULL before referring
Comment 1 Miguel París Díaz 2016-07-05 14:55:25 UTC
Created attachment 330909 [details] [review]
pad: check caps not NULL before referring
Comment 2 Sebastian Dröge (slomo) 2016-07-05 16:38:11 UTC
Review of attachment 330909 [details] [review]:

::: gst/gstpad.c
@@ +2759,2 @@
   query = gst_query_new_caps (mycaps);
   gst_pad_peer_query (pad, query);

It should rather check if this returns TRUE or not. If it does, we use the caps (and they must be non-NULL). Otherwise we just go out.
Comment 3 Miguel París Díaz 2016-07-05 16:43:47 UTC
Review of attachment 330909 [details] [review]:

::: gst/gstpad.c
@@ +2759,2 @@
   query = gst_query_new_caps (mycaps);
   gst_pad_peer_query (pad, query);

Could someone answer the query caps with NULL?
Comment 4 Sebastian Dröge (slomo) 2016-07-05 16:47:02 UTC
If the query returns TRUE, no. It would be possible of course but it would be a programming mistake (so maybe make it a g_warn_if_fail() or similar).
Comment 5 Miguel París Díaz 2016-07-05 17:19:21 UTC
Created attachment 330914 [details] [review]
pad: check query caps answered and caps not NULL
Comment 6 Sebastian Dröge (slomo) 2016-07-05 17:28:09 UTC
Review of attachment 330914 [details] [review]:

::: gst/gstpad.c
@@ +2767,3 @@
+    gst_caps_ref (caps);
+  } else {
+    g_warning ("Caps are NULL");

That's not useful information when printed later :) Make this a "g_warn_if_fail (caps != NULL)", which is a double-check then but will print the assertion and also source file and line.
Comment 7 Miguel París Díaz 2016-07-06 08:37:32 UTC
Created attachment 330933 [details] [review]
pad: check query caps answered and caps not NULL
Comment 8 Sebastian Dröge (slomo) 2016-07-07 07:08:35 UTC
Attachment 330933 [details] pushed as 9f982e2 - pad: check query caps answered and caps not NULL