summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-09-14 20:15:23 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-09-14 20:49:55 +0200
commit855b7059800018e5fe5a0f8af8e7d85152883775 (patch)
tree2c308a5597d09953a00eebfe625278a2a6f4210f
parent29edc867212a75bfc535e653422a4f08b83ef9ff (diff)
downloadmpv-855b7059800018e5fe5a0f8af8e7d85152883775.tar.bz2
mpv-855b7059800018e5fe5a0f8af8e7d85152883775.tar.xz
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.
-rw-r--r--stream/stream_dvd.c4
1 files changed, 2 insertions, 2 deletions
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;
}