asfdemux: Parse last simple index entry
authorThiago Santos <ts.santos@partner.samsung.com>
Tue, 24 Sep 2013 17:07:25 +0000 (10:07 -0700)
committerSebastian Dröge <slomo@circular-chaos.org>
Mon, 30 Sep 2013 08:23:24 +0000 (10:23 +0200)
The entry size is fixed at 6, fix typo to finish parsing the index
correctly until the last sample

gst/asfdemux/gstasfdemux.c

index 4c4278dccea7a40b03a83683d9e72a4255814e82..a19d223ce61d6956766e567b7273d27825986d4e 100644 (file)
@@ -3574,8 +3574,13 @@ gst_asf_demux_process_simple_index (GstASFDemux * demux, guint8 * data,
     demux->sidx_entries = g_new0 (AsfSimpleIndexEntry, count);
 
     for (i = 0; i < count; ++i) {
-      if (G_UNLIKELY (size <= 6))
+      if (G_UNLIKELY (size < 6)) {
+        /* adjust for broken files, to avoid having entries at the end
+         * of the parsed index that point to time=0. Resulting in seeking to
+         * the end of the file leading back to the beginning */
+        demux->sidx_num_entries -= (count - i);
         break;
+      }
       demux->sidx_entries[i].packet = gst_asf_demux_get_uint32 (&data, &size);
       demux->sidx_entries[i].count = gst_asf_demux_get_uint16 (&data, &size);
       GST_LOG_OBJECT (demux, "%" GST_TIME_FORMAT " = packet %4u  count : %2d",