[DVDnav-discuss] badly handled exception in libdvdread

Michael J. Smith smith at codesmith.com
Sun Jul 24 19:46:18 CEST 2011


During scanning of the DVD menus from the source file ifo_read.c, I noticed it does not clean up the ptl_mait reference AFTER it free's it.  This causes crashes in handbrake as it is scanning the DVD.

I found a reasonable fix to ifo_read.c to be (relevant diff -u for my change):

@@ -1300,9 +1299,10 @@
     if(!DVDFileSeek_(ifofile->file,
 		     ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN
                      + ptl_mait->countries[i].pf_ptl_mai_start_byte)) {
       fprintf(stderr, "libdvdread: Unable to seek PTL_MAIT table.\n");
       free(ptl_mait->countries);
       free(ptl_mait);
+      ifofile->ptl_mait = NULL;
       return 0;


This allows other code to properly ignore the ptl_mait as being invalid.
I checked this against the libdvdread-4.1.3 code and it appears to still not be fixed so I thought I would provide the "results" of my afternoon of bug hunting.

Hope this help,

As a curiosity, if this is used please drop me a line and let me know.

Thanks,

Mike





More information about the DVDnav-discuss mailing list