[MPlayer-users] Crash seeking to chapters in a multi-VTS DVD if title is gt 1

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Jan 1 11:22:41 CET 2009


On Thu, Jan 01, 2009 at 10:52:31AM +0100, Ilja Sekler wrote:
> On 31.12.2008 19:02, Nico Sabbi wrote:
> 
> > Il giorno mer, 31/12/2008 alle 15.06 +0100, Reimar Döffinger ha
> > scritto:
> > 
> >> AFAICT the dvdread API is supposed to return 0 on error (I have no
> >> clue what then the point is of allowing negative values, since I
> >> can't see how they would make any sense, I only see this API
> >> behaviour bloating up the libdvdread code for no good reason). 
> >> Problem is, dvdcss read function may also return negative values on
> >> read errors, and the return values of dvdcss are passed through. So
> >> we will end up with len < 0 here and thus an endless loop. Changing
> >> !len to len <= 0 fixes it, and while I am in favour of such a fix
> >> it breaks the dvdread API.
> > 
> > thanks for fixing it :)
> 
> Unfortunately, the fix for the hang seeking to chapters > max available
> doesn't help against the crash
> <http://lists.mplayerhq.hu/pipermail/mplayer-users/2008-December/075498.html>.
> It is apparently a different bug.

Well, that is no surprise. To everyone's joy libdvdread never got beyond
exporting a raw dump of the hopelessly convoluted DVD structure with
contradicting information placed all over.
Unfortunately, I do not have a DVD where the main feature is not the
first title, so I can not actually check if it works for those files,
but I think this patch might be correct:
Index: stream/stream_dvd.c
===================================================================
--- stream/stream_dvd.c (revision 28216)
+++ stream/stream_dvd.c (working copy)
@@ -570,6 +570,15 @@
     if(!vts_file || !tt_srpt)
        return 0;
 
+    if(title_no < 0 || title_no >= tt_srpt->nr_of_srpts)
+       return 0;
+
+    // map global title to vts title
+    title_no = tt_srpt->title[title_no].vts_ttn - 1;
+
+    if(title_no < 0 || title_no >= vts_file->vts_ptt_srpt->nr_of_srpts)
+       return 0;
+
     if(chapter < 0 || chapter > vts_file->vts_ptt_srpt->title[title_no].nr_of_ptts-1) //no such chapter
        return 0;
 
Greetings,
Reimar Döffinger



More information about the MPlayer-users mailing list