diff options
author | jstebbins <[email protected]> | 2009-05-29 00:01:27 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2009-05-29 00:01:27 +0000 |
commit | a68aacb617dcde966183dafda5e5abe196baae10 (patch) | |
tree | ab224d6a0cc55a9cbaa1067378896fa29afe8d5b /libhb/dvdnav.c | |
parent | 6bb8cd67170a5a2f20aad58745c257d11e386ec6 (diff) |
dvdnav: fix crash that occurs when a PGC has no programs
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2457 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/dvdnav.c')
-rw-r--r-- | libhb/dvdnav.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libhb/dvdnav.c b/libhb/dvdnav.c index 515de1ee0..589c9160e 100644 --- a/libhb/dvdnav.c +++ b/libhb/dvdnav.c @@ -251,6 +251,12 @@ PttDuration(ifo_handle_t *ifo, int ttn, int pttn, int *blocks, int *last_pgcn) hb_error( "scan: pgc not valid, skipping" ); break; } + if (pgn > pgc->nr_of_programs) + { + pgn = 1; + continue; + } + duration += 90LL * dvdtime2msec( &pgc->playback_time ); cell_start = pgc->program_map[pgn-1] - 1; @@ -419,6 +425,11 @@ static hb_title_t * hb_dvdnav_title_scan( hb_dvd_t * e, int t ) pgc = ifo->vts_pgcit->pgci_srp[pgcn-1].pgc; hb_log("pgc_id: %d, pgn: %d: pgc: 0x%x", pgcn, pgn, pgc); + if (pgn > pgc->nr_of_programs) + { + hb_error( "invalid PGN %d for title %d, skipping", pgn, t ); + goto fail; + } /* Title start */ title->cell_start = pgc->program_map[pgn-1] - 1; |