gst/qtdemux/qtdemux.c: Don't crash by dividing by zero (see sample movie in #126922).
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Mon, 13 Sep 2004 20:13:32 +0000 (20:13 +0000)
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>
Mon, 13 Sep 2004 20:13:32 +0000 (20:13 +0000)
Original commit message from CVS:
* gst/qtdemux/qtdemux.c: (gst_qtdemux_add_stream),
(qtdemux_parse_trak):
Don't crash by dividing by zero (see sample movie in #126922).

ChangeLog
gst/qtdemux/qtdemux.c

index c495c715cdb3c2909cc6bb58549302ae724c3add..1e54c3bdbd46ab21ca9ff75ae54352754924585b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-09-13  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
+
+       * gst/qtdemux/qtdemux.c: (gst_qtdemux_add_stream),
+       (qtdemux_parse_trak):
+         Don't crash by dividing by zero (see sample movie in #126922).
+
 2004-09-13  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
        * gst/qtdemux/qtdemux.c: (qtdemux_audio_caps):
index e4a54f0747bcd789f73b11d39b17077f04b803a1..1abaf0f2d352e6749a5515f88edd000ba86df332 100644 (file)
@@ -850,7 +850,8 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux, QtDemuxStream * stream)
   g_print ("setting caps %s\n", gst_caps_to_string (stream->caps));
   gst_pad_set_explicit_caps (stream->pad, stream->caps);
 
-  GST_DEBUG ("adding pad %p to qtdemux %p", stream->pad, qtdemux);
+  GST_DEBUG ("adding pad %s %p to qtdemux %p",
+      gst_pad_get_name (stream->pad), stream->pad, qtdemux);
   gst_element_add_pad (GST_ELEMENT (qtdemux), stream->pad);
 }
 
@@ -2117,9 +2118,12 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
         }
         samples[j].chunk = j;
         samples[j].offset = chunk_offset;
-        samples[j].size =
-            samples_per_chunk * stream->bytes_per_frame /
-            stream->samples_per_packet / stream->compression;
+        if (stream->samples_per_packet * stream->compression != 0)
+          samples[j].size =
+              samples_per_chunk * stream->bytes_per_frame /
+              stream->samples_per_packet / stream->compression;
+        else
+          samples[j].size = 0;
         samples[j].duration =
             samples_per_chunk * GST_SECOND / (stream->rate / 2);
         samples[j].timestamp = timestamp;