summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvan <[email protected]>2009-03-11 05:11:02 +0000
committervan <[email protected]>2009-03-11 05:11:02 +0000
commit1317c0d6d70d62f8a2442c3df429a3cf4dfddb31 (patch)
tree6176dfadbdbf3a800ef8733b6cb15d3b90c40fd1
parent37d5d86a7674c8bb20c899184c30ec0128b367a8 (diff)
Detect bogus cell start and last addresses while scanning each title so we don't crash later in dvdread. Fix from user "greed" in forum thread http://forum.handbrake.fr/viewtopic.php?f=4&t=9758&start=0
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2256 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--libhb/dvd.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/libhb/dvd.c b/libhb/dvd.c
index 85fe47e8d..240d3bc2e 100644
--- a/libhb/dvd.c
+++ b/libhb/dvd.c
@@ -235,6 +235,37 @@ hb_title_t * hb_dvd_title_scan( hb_dvd_t * d, int t )
goto fail;
}
+ /* ignore titles with bogus cell addresses so we don't abort later
+ * in libdvdread. */
+ for ( i = 0; i < vts->vts_c_adt->nr_of_vobs; ++i)
+ {
+ if( (vts->vts_c_adt->cell_adr_table[i].start_sector & 0xffffff ) ==
+ 0xffffff )
+ {
+ hb_error( "scan: cell_adr_table[%d].start_sector invalid (0x%x) "
+ "- skipping title", i,
+ vts->vts_c_adt->cell_adr_table[i].start_sector );
+ goto fail;
+ }
+ if( (vts->vts_c_adt->cell_adr_table[i].last_sector & 0xffffff ) ==
+ 0xffffff )
+ {
+ hb_error( "scan: cell_adr_table[%d].last_sector invalid (0x%x) "
+ "- skipping title", i,
+ vts->vts_c_adt->cell_adr_table[i].last_sector );
+ goto fail;
+ }
+ if( vts->vts_c_adt->cell_adr_table[i].start_sector >=
+ vts->vts_c_adt->cell_adr_table[i].last_sector )
+ {
+ hb_error( "scan: cell_adr_table[%d].start_sector (0x%x) "
+ "is not before last_sector (0x%x) - skipping title", i,
+ vts->vts_c_adt->cell_adr_table[i].start_sector,
+ vts->vts_c_adt->cell_adr_table[i].last_sector );
+ goto fail;
+ }
+ }
+
/* Detect languages */
for( i = 0; i < vts->vtsi_mat->nr_of_vts_audio_streams; i++ )
{