matroska: fix check for amount of data to read
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Wed, 16 Apr 2014 16:29:30 +0000 (17:29 +0100)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Wed, 16 Apr 2014 16:44:51 +0000 (17:44 +0100)
History shows length==0 should set data to NULL and return,
so we do that too instead of trying to read nothing.

Coverity 206205

gst/matroska/ebml-read.c

index a23947f..97665ca 100644 (file)
@@ -377,7 +377,7 @@ gst_ebml_read_bytes (GstEbmlRead * ebml, guint32 * id, const guint8 ** data,
     return GST_FLOW_ERROR;      /* FIXME: do proper error handling */
 
   *data = NULL;
-  if (G_LIKELY (length >= 0)) {
+  if (G_LIKELY (length > 0)) {
     if (!gst_byte_reader_get_data (gst_ebml_read_br (ebml), length, data))
       return GST_FLOW_PARSE;
   }