rtph265depay: prevent trying to get 0 bytes from adapter
authorLuis de Bethencourt <luis@debethencourt.com>
Wed, 12 Aug 2015 13:59:53 +0000 (14:59 +0100)
committerLuis de Bethencourt <luis@debethencourt.com>
Wed, 12 Aug 2015 14:05:02 +0000 (15:05 +0100)
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.

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

gst/rtp/gstrtph265depay.c

index 941a5db..15599cc 100644 (file)
@@ -1167,10 +1167,12 @@ gst_rtp_h265_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
         }
 
         outsize = gst_adapter_available (rtph265depay->adapter);
-        outbuf = gst_adapter_take_buffer (rtph265depay->adapter, outsize);
-
-        outbuf = gst_rtp_h265_depay_handle_nal (rtph265depay, outbuf, timestamp,
-            marker);
+        if (outsize > 0) {
+          outbuf = gst_adapter_take_buffer (rtph265depay->adapter, outsize);
+          outbuf =
+              gst_rtp_h265_depay_handle_nal (rtph265depay, outbuf, timestamp,
+              marker);
+        }
         break;
       }
       case 49: