Mercurial > mplayer.hg
comparison libmpdemux/demux_mkv.c @ 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 |
comparison
equal
deleted
inserted
replaced
29694:58b03e2d2ac2 | 29695:7eaa16c03a87 |
---|---|
2959 uint64_t target_filepos, cluster_pos, max_pos; | 2959 uint64_t target_filepos, cluster_pos, max_pos; |
2960 | 2960 |
2961 target_filepos = (uint64_t) (target_timecode * mkv_d->last_filepos | 2961 target_filepos = (uint64_t) (target_timecode * mkv_d->last_filepos |
2962 / (mkv_d->last_pts * 1000.0)); | 2962 / (mkv_d->last_pts * 1000.0)); |
2963 | 2963 |
2964 max_pos = mkv_d->cluster_positions[mkv_d->num_cluster_pos-1]; | 2964 max_pos = mkv_d->num_cluster_pos ? mkv_d->cluster_positions[mkv_d->num_cluster_pos-1] : 0; |
2965 if (target_filepos > max_pos) | 2965 if (target_filepos > max_pos) |
2966 { | 2966 { |
2967 if ((off_t) max_pos > stream_tell (s)) | 2967 if ((off_t) max_pos > stream_tell (s)) |
2968 stream_seek (s, max_pos); | 2968 stream_seek (s, max_pos); |
2969 else | 2969 else |