rtph264depay: prevent trying to get 0 bytes from adapter
authorThiago Santos <thiagoss@osg.samsung.com>
Wed, 4 Feb 2015 05:25:44 +0000 (02:25 -0300)
committerThiago Santos <thiagoss@osg.samsung.com>
Thu, 5 Feb 2015 00:37:50 +0000 (21:37 -0300)
This causes an assertion and would lead to getting a NULL instead
of a buffer. Without proper checking this would easily lead to
a segfault

https://bugzilla.gnome.org/show_bug.cgi?id=737199

gst/rtp/gstrtph264depay.c

index 586cf73..756730c 100644 (file)
@@ -955,10 +955,12 @@ gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
         }
 
         outsize = gst_adapter_available (rtph264depay->adapter);
-        outbuf = gst_adapter_take_buffer (rtph264depay->adapter, outsize);
-
-        outbuf = gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp,
-            marker);
+        if (outsize > 0) {
+          outbuf = gst_adapter_take_buffer (rtph264depay->adapter, outsize);
+          outbuf =
+              gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, timestamp,
+              marker);
+        }
         break;
       }
       case 26: