qtdemux: guard against invalid frame size to avoid division by 0
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Fri, 2 May 2014 08:49:32 +0000 (09:49 +0100)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Fri, 2 May 2014 08:49:32 +0000 (09:49 +0100)
Coverity 1139690

gst/isomp4/qtdemux.c

index 8732f1e..613edad 100644 (file)
@@ -3885,6 +3885,9 @@ gst_qtdemux_clip_buffer (GstQTDemux * qtdemux, QtDemuxStream * stream,
   } else
     goto wrong_type;
 
+  if (frame_size <= 0)
+    goto bad_frame_size;
+
   /* we can only clip if we have a valid pts */
   pts = GST_BUFFER_PTS (buf);
   if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (pts)))
@@ -3953,6 +3956,11 @@ wrong_type:
     GST_DEBUG_OBJECT (qtdemux, "unknown stream type");
     return buf;
   }
+bad_frame_size:
+  {
+    GST_DEBUG_OBJECT (qtdemux, "bad frame size");
+    return buf;
+  }
 no_pts:
   {
     GST_DEBUG_OBJECT (qtdemux, "no pts on buffer");