From 910e08034f29b35563b695971c8713a5da72fbb2 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 4 Nov 2012 18:03:33 +0100 Subject: [PATCH] Add a couple of additional sanity checks for dvdnav_describe_title_chapters() Fixes crashes with non-compliant DVDs after applying the duplicate detection patch for libdvdread. It might make more sense to do those checks in libdvdread instead and zero out structures that don't check out. --- src/searching.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/searching.c b/src/searching.c index 4c3fb2f..c044199 100644 --- a/src/searching.c +++ b/src/searching.c @@ -620,6 +620,18 @@ uint32_t dvdnav_describe_title_chapters(dvdnav_t *this, int32_t title, uint64_t printerr("PGC start out of bounds"); continue; } + if (0 == ifo->vts_pgcit->pgci_srp[ptt[i].pgcn-1].pgc_start_byte) { + printerr("PGC start zero."); + continue; + } + if (0 != (ifo->vts_pgcit->pgci_srp[ptt[i].pgcn-1].pgc_start_byte & 1)) { + printerr("PGC start unaligned."); + continue; + } + if (0 != ((int)(ifo->vts_pgcit->pgci_srp[ptt[i].pgcn-1].pgc) & 1)) { + printerr("PGC pointer unaligned."); + continue; + } pgc = ifo->vts_pgcit->pgci_srp[ptt[i].pgcn-1].pgc; if (pgc == NULL) { printerr("PGC missing."); -- 1.8.0