From 855b7059800018e5fe5a0f8af8e7d85152883775 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 14 Sep 2013 20:15:23 +0200 Subject: stream_dvd: prevent segmentation fault with some broken files I have a sample where some final chapters are missing. This was causing a segmentation fault when trying to fetch chapter times for them. This makes the code ignore those chapters. --- stream/stream_dvd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'stream') diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index 7f5280c1c3..4e5f9ea5e7 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -496,7 +496,7 @@ static int get_chapter_time(ifo_handle_t *vts_file, tt_srpt_t *tt_srpt, int titl last_cell = pgc->program_map[ptt[i].pgn]; else last_cell = 0; - do { + while (cell < last_cell) { if(!(pgc->cell_playback[cell-1].block_type == BLOCK_TYPE_ANGLE_BLOCK && pgc->cell_playback[cell-1].block_mode != BLOCK_MODE_FIRST_CELL) ) { @@ -508,7 +508,7 @@ static int get_chapter_time(ifo_handle_t *vts_file, tt_srpt_t *tt_srpt, int titl cur++; } cell++; - } while(cell < last_cell); + } } return 0; } -- cgit v1.2.3