changeset 29695:7eaa16c03a87

Avoid a possible crash if num_cluster_pos is 0.
author reimar
date Wed, 30 Sep 2009 07:45:10 +0000
parents 58b03e2d2ac2
children d3a6947ca46a
files libmpdemux/demux_mkv.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.c	Wed Sep 30 07:41:00 2009 +0000
+++ b/libmpdemux/demux_mkv.c	Wed Sep 30 07:45:10 2009 +0000
@@ -2961,7 +2961,7 @@
           target_filepos = (uint64_t) (target_timecode * mkv_d->last_filepos
                                        / (mkv_d->last_pts * 1000.0));
 
-          max_pos = mkv_d->cluster_positions[mkv_d->num_cluster_pos-1];
+          max_pos = mkv_d->num_cluster_pos ? mkv_d->cluster_positions[mkv_d->num_cluster_pos-1] : 0;
           if (target_filepos > max_pos)
             {
               if ((off_t) max_pos > stream_tell (s))