summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-09-14 20:15:23 +0200
committerwm4 <wm4@nowhere>2013-09-20 21:19:30 +0200
commitb3a0557bc8ee59a4f0045b1f874d5e45b639cbaa (patch)
treecd5ae43d3ccc71e636f2e4d66d34117327289f16
parent15dd1d1f8dbd62b70e537a5cc77fd3c1172eda3f (diff)
downloadmpv-b3a0557bc8ee59a4f0045b1f874d5e45b639cbaa.tar.bz2
mpv-b3a0557bc8ee59a4f0045b1f874d5e45b639cbaa.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 0372e6c3c0..af7606ebf4 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;
}