From: jstebbins Date: Fri, 29 May 2009 00:01:27 +0000 (+0000) Subject: dvdnav: fix crash that occurs when a PGC has no programs X-Git-Url: http://git.osdn.jp/view?a=commitdiff_plain;h=07e41d43fd24d0589c2db1c498923287bb3522d7;p=handbrake-jp%2Fhandbrake-jp-git.git dvdnav: fix crash that occurs when a PGC has no programs git-svn-id: svn://localhost/HandBrake/trunk@2457 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/libhb/dvdnav.c b/libhb/dvdnav.c index 515de1ee..589c9160 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;