bug in libdvdread causes "libdvdnav" segfaults - patch included

Peter Niemayer <[email protected]>
Newsgroups gmane.comp.video.mplayer.devel,gmane.comp.video.ogle.devel
Message-ID <[email protected]>
Hi,

I experienced several segfaults when trying to play (unencrypted) DVDs
from harddisk using xine/ogle/mplayer with the respective libdvdnav 
support feature.

I found that while libdvdnav itself may do something wrong by trying
to read beyond the end of the files, it was actually the fault of libdvdread
that a segfault resulted. The following tiny patch fixes the problem
and it seems that libdvdnav can very well live with the "short read"
result it gets then - navigation worked fine after applying the patch:

-----------------------------------------------------------------------------
--- dvd_reader.c.orig   Mon Sep  9 21:40:16 2002
+++ dvd_reader.c        Mon Sep  9 21:41:13 2002
@@ -795,6 +795,11 @@
                /* FIXME: This is wrong if i is the last file in the set. 
                  * also error from this read will not show in ret. */
 
+               if (dvd_file->title_devs[i + 1] == 0) {
+                       /* no further files available */
+                       return ret;
+               }
+
                 /* Read part 2 */
                 off = DVDinput_seek( dvd_file->title_devs[ i + 1 ], 
                                     0, DVDINPUT_NOFLAGS );
-----------------------------------------------------------------------------

Whoever has write-access to the libdvdread CVS: Please put the fix in :-)


Regards,

Peter Niemayer
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.