Here are the patches that I intend to push to svn soon. I would like to test them a bit longer and get your eyeballs on these patches before I push. All criticism appreciated.
Some of these patches were originated by other people and just put into my tree (thanks to all of you for submissions). Thanks E -- Erik Hovland [email protected] http://hovland.org/
From a0b584dc038eef9ed8b0a31a0458fa19845a3f8d Mon Sep 17 00:00:00 2001 From: Erik Hovland <[email protected]> Date: Thu, 24 Jun 2010 15:03:03 -0700 Subject: [PATCH 1/8] Check the return value for potential errors --- src/dvd_udf.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/dvd_udf.c b/src/dvd_udf.c index fb932b6..514bafa 100644 --- a/src/dvd_udf.c +++ b/src/dvd_udf.c @@ -611,7 +611,9 @@ static int UDFScanDir( dvd_reader_t *device, struct AD Dir, char *FileName, memcpy(FileICB, &tmpICB, sizeof(tmpICB)); found = 1; } - UDFMapICB(device, tmpICB, &tmpFiletype, partition, &tmpFile); + if(!UDFMapICB(device, tmpICB, &tmpFiletype, partition, &tmpFile)) + return 0; + } else { if( !strcasecmp( FileName, filename ) ) { memcpy(FileICB, &tmpICB, sizeof(tmpICB)); -- 1.7.5.4
From e6a378b53b7d8d961dfe87834eb6aed9035a1bb3 Mon Sep 17 00:00:00 2001 From: Erik Hovland <[email protected]> Date: Mon, 26 Sep 2011 10:08:12 -0700 Subject: [PATCH 2/8] Use a macro instead of a magic constant The levels value is in a macro in the very next line of ifo_types.h. The static array declared above it should use it. --- src/dvdread/ifo_types.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/dvdread/ifo_types.h b/src/dvdread/ifo_types.h index 7db7d34..6e5f4a1 100644 --- a/src/dvdread/ifo_types.h +++ b/src/dvdread/ifo_types.h @@ -475,7 +475,7 @@ typedef struct { * Parental Management Information Unit Table. * Level 1 (US: G), ..., 7 (US: NC-17), 8 */ -#define PTL_MAIT_NUM_LEVEL 8 +#define PTL_MAIT_NUM_LEVEL 8U typedef uint16_t pf_level_t[PTL_MAIT_NUM_LEVEL]; /** -- 1.7.5.4
From 28a0e2df6b6a52548a868470dda4e3d1357ad553 Mon Sep 17 00:00:00 2001 From: Erik Hovland <[email protected]> Date: Mon, 10 Oct 2011 14:59:04 -0700 Subject: [PATCH 3/8] Clear pf_temp to make sure it is initialized --- src/ifo_read.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/ifo_read.c b/src/ifo_read.c index e21aa9e..8e5e9dd 100644 --- a/src/ifo_read.c +++ b/src/ifo_read.c @@ -1372,6 +1372,7 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) { ifofile->ptl_mait = NULL; return 0; } + memset(pf_temp, 0, info_length); if(!(DVDReadBytes(ifofile->file, pf_temp, info_length))) { fprintf(stderr, "libdvdread: Unable to read PTL_MAIT table at index %d.\n",i); free(pf_temp); -- 1.7.5.4
From 946ba2e3f5600bad946994de6fe05b46fccec9fb Mon Sep 17 00:00:00 2001 From: Erik Hovland <[email protected]> Date: Mon, 10 Oct 2011 15:07:14 -0700 Subject: [PATCH 4/8] Check ifoRead_VTS before continuing --- src/ifo_read.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/src/ifo_read.c b/src/ifo_read.c index 8e5e9dd..fad5bcb 100644 --- a/src/ifo_read.c +++ b/src/ifo_read.c @@ -475,8 +475,7 @@ ifo_handle_t *ifoOpenVTSI(dvd_reader_t *dvd, int title) { return NULL; } - ifoRead_VTS(ifofile); - if(ifofile->vtsi_mat) + if(ifoRead_VTS(ifofile) && ifofile->vtsi_mat) return ifofile; fprintf(stderr, "libdvdread: Invalid IFO for title %d (VTS_%02d_0.IFO).\n", -- 1.7.5.4
From e170cbc56844b03db6bed41fc7013265be01c1f0 Mon Sep 17 00:00:00 2001 From: Erik Hovland <[email protected]> Date: Mon, 10 Oct 2011 15:08:24 -0700 Subject: [PATCH 5/8] Use NULL instead of 0, this is C kids --- src/ifo_read.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ifo_read.c b/src/ifo_read.c index fad5bcb..e5dd243 100644 --- a/src/ifo_read.c +++ b/src/ifo_read.c @@ -475,7 +475,7 @@ ifo_handle_t *ifoOpenVTSI(dvd_reader_t *dvd, int title) { return NULL; } - if(ifoRead_VTS(ifofile) && ifofile->vtsi_mat) + if(ifoRead_VTS(ifofile) && ifofile->vtsi_mat != NULL) return ifofile; fprintf(stderr, "libdvdread: Invalid IFO for title %d (VTS_%02d_0.IFO).\n", @@ -619,19 +619,19 @@ static int ifoRead_VTS(ifo_handle_t *ifofile) { if(!DVDFileSeek_(ifofile->file, 0)) { free(ifofile->vtsi_mat); - ifofile->vtsi_mat = 0; + ifofile->vtsi_mat = NULL; return 0; } if(!(DVDReadBytes(ifofile->file, vtsi_mat, sizeof(vtsi_mat_t)))) { free(ifofile->vtsi_mat); - ifofile->vtsi_mat = 0; + ifofile->vtsi_mat = NULL; return 0; } if(strncmp("DVDVIDEO-VTS", vtsi_mat->vts_identifier, 12) != 0) { free(ifofile->vtsi_mat); - ifofile->vtsi_mat = 0; + ifofile->vtsi_mat = NULL; return 0; } -- 1.7.5.4
From 5a6374c00f173101b1914f5862f91c4704dfbece Mon Sep 17 00:00:00 2001 From: Erik Hovland <[email protected]> Date: Mon, 10 Oct 2011 15:49:49 -0700 Subject: [PATCH 6/8] Update the TODO file --- TODO | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 3fe2eed..870ffe6 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,7 @@ -* Support DVDs with errors on them. So we can recover from corrupt sectors in the .VOB. Also, handle corrupt .IFO files by using the backup .BUP files. -* Support Random and Shuffle Titles. Only sequencial Titles are currently supported. +* Support DVDs with errors on them. So we can recover from corrupt sectors in + the .VOB. Be able to read the VAT ICB at the last sector of the UDF disk (see + function UDFGetAVDP) +* Support Random and Shuffle Titles. Only sequential Titles are currently supported. * rework documentation * implement restriction levels: 0 - execute everything as the app commands @@ -8,5 +10,4 @@ 3 - fully respect user prohibitions * cleanup public API and fix libtool versioning * Update decoder.c with some of the more rare commands. Update already done to vmcmd.c -* RELEASE! (maybe it's time for libdvdnav 0.5?) -* Replace the auto* build system with a custom and clean one based on ffmpeg's (partly done) +* Replace the auto* build system with a custom and clean one based on ffmpeg's (mostly done) -- 1.7.5.4
From 77b4521b0f9245f2b69e26f873e1432143754040 Mon Sep 17 00:00:00 2001 From: Erik Hovland <[email protected]> Date: Mon, 10 Oct 2011 15:50:17 -0700 Subject: [PATCH 7/8] Remove unnecessary config include in dvd_input.c --- src/dvd_input.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/dvd_input.c b/src/dvd_input.c index 8261847..a38c81c 100644 --- a/src/dvd_input.c +++ b/src/dvd_input.c @@ -24,7 +24,6 @@ #include <fcntl.h> #include <unistd.h> -#include "config.h" #include "dvdread/dvd_reader.h" #include "dvd_input.h" -- 1.7.5.4
From 6e6316631b4db3677971b1749954c529df072b77 Mon Sep 17 00:00:00 2001 From: Erik Hovland <[email protected]> Date: Sat, 12 Nov 2011 12:29:23 -0800 Subject: [PATCH 8/8] Sanitize PTT start offsets If the start offset points past the last_byte (outside the region read) stop reading PTTs and adjust nr_of_srpts. Fixes Transformers 3. Patch provided by John Stebbins <stebbins AT jetheaddev DOT com>. Thanks! --- src/ifo_read.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/src/ifo_read.c b/src/ifo_read.c index e5dd243..44356b6 100644 --- a/src/ifo_read.c +++ b/src/ifo_read.c @@ -1189,7 +1189,15 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) { goto fail; } for(i = 0; i < vts_ptt_srpt->nr_of_srpts; i++) { - B2N_32(data[i]); + /* Transformers 3 has PTT start bytes that point outside the SRPT PTT */ + uint32_t start = data[i]; + B2N_32(start); + if(start + sizeof(ptt_info_t) > vts_ptt_srpt->last_byte + 1) { + /* don't mess with any bytes beyond the end of the allocation */ + vts_ptt_srpt->nr_of_srpts = i; + break; + } + data[i] = start; /* assert(data[i] + sizeof(ptt_info_t) <= vts_ptt_srpt->last_byte + 1); Magic Knight Rayearth Daybreak is mastered very strange and has Titles with 0 PTTs. They all have a data[i] offsets beyond the end of -- 1.7.5.4
_______________________________________________ DVDnav-discuss mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/dvdnav-discuss
