diff options
author | van <[email protected]> | 2009-04-12 06:59:40 +0000 |
---|---|---|
committer | van <[email protected]> | 2009-04-12 06:59:40 +0000 |
commit | 7c54b2bdfdcfa132eed627f8d1a4d02bd888c3e7 (patch) | |
tree | 8c7503137e577faaa34fd2518b2f6dbe6bf7897b /libhb/dvd.c | |
parent | ba1667e3bd232bacd5a8f525bd07c506e240ca5a (diff) |
Don't crash during scan when a DVD contains an invalid PTT or PGC index. (Bug & fix from user macrule in forum post http://forum.handbrake.fr/viewtopic.php?f=4&t=10291&sid=8b5a573526397f7c26c44e2a50c6dc63#p54152)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2319 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/dvd.c')
-rw-r--r-- | libhb/dvd.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libhb/dvd.c b/libhb/dvd.c index 358cb552b..479157e8a 100644 --- a/libhb/dvd.c +++ b/libhb/dvd.c @@ -203,9 +203,19 @@ hb_title_t * hb_dvd_title_scan( hb_dvd_t * d, int t ) /* Position of the title in the VTS */ title->ttn = d->vmg->tt_srpt->title[t-1].vts_ttn; + if ( title->ttn < 1 || title->ttn > vts->vts_ptt_srpt->nr_of_srpts ) + { + hb_error( "invalid VTS PTT offset %d for title %d, skipping", title->ttn, t ); + goto fail; + } /* Get pgc */ pgc_id = vts->vts_ptt_srpt->title[title->ttn-1].ptt[0].pgcn; + if ( pgc_id < 1 || pgc_id > vts->vts_pgcit->nr_of_pgci_srp ) + { + hb_error( "invalid PGC ID %d for title %d, skipping", pgc_id, t ); + goto fail; + } pgn = vts->vts_ptt_srpt->title[title->ttn-1].ptt[0].pgn; d->pgc = vts->vts_pgcit->pgci_srp[pgc_id-1].pgc; |