summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaylor Ralph <tralph@mythtv.org>2011-11-07 03:01:02 (GMT)
committer Taylor Ralph <tralph@mythtv.org>2011-11-07 03:01:02 (GMT)
commitb1ff37e61987f14c657b096e109cba9d63cf5ece (patch)
tree0787dd6789471ead796c6d274dea99c979914936
parent8b2c9727d393686fd4c65b478a644ff83a01be2d (diff)
libdvdread: backport upstream changesets r1232 and r1234.
This fixes playback of some discs that have been recently reported as failing.
-rw-r--r--mythtv/libs/libmythdvdnav/dvdread/dvd_udf.c10
-rw-r--r--mythtv/libs/libmythdvdnav/dvdread/ifo_read.c4
2 files changed, 10 insertions, 4 deletions
diff --git a/mythtv/libs/libmythdvdnav/dvdread/dvd_udf.c b/mythtv/libs/libmythdvdnav/dvdread/dvd_udf.c
index dfa134b..1574fe5 100644
--- a/mythtv/libs/libmythdvdnav/dvdread/dvd_udf.c
+++ b/mythtv/libs/libmythdvdnav/dvdread/dvd_udf.c
@@ -333,16 +333,17 @@ static int SetUDFCache(dvd_reader_t *device, UDFCacheType type,
static int Unicodedecode( uint8_t *data, int len, char *target )
{
int p = 1, i = 0;
+ int err = 0;
if( ( data[ 0 ] == 8 ) || ( data[ 0 ] == 16 ) ) do {
- if( data[ 0 ] == 16 ) p++; /* Ignore MSB of unicode16 */
+ if( data[ 0 ] == 16 ) err |= data[p++]; /* character cannot be converted to 8bit, return error */
if( p < len ) {
target[ i++ ] = data[ p++ ];
}
} while( p < len );
target[ i ] = '\0';
- return 0;
+ return !err;
}
static int UDFDescriptor( uint8_t *data, uint16_t *TagID )
@@ -494,8 +495,9 @@ static int UDFFileIdentifier( uint8_t *data, uint8_t *FileCharacteristics,
L_FI = GETN1(19);
UDFLongAD(&data[20], FileICB);
L_IU = GETN2(36);
- if (L_FI) Unicodedecode(&data[38 + L_IU], L_FI, FileName);
- else FileName[0] = '\0';
+ if (L_FI) {
+ if (!Unicodedecode(&data[38 + L_IU], L_FI, FileName)) FileName[0] = 0;
+ } else FileName[0] = '\0';
return 4 * ((38 + L_FI + L_IU + 3) / 4);
}
diff --git a/mythtv/libs/libmythdvdnav/dvdread/ifo_read.c b/mythtv/libs/libmythdvdnav/dvdread/ifo_read.c
index b94ac35..e3d0e00 100644
--- a/mythtv/libs/libmythdvdnav/dvdread/ifo_read.c
+++ b/mythtv/libs/libmythdvdnav/dvdread/ifo_read.c
@@ -1191,6 +1191,10 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) {
return 0;
}
+ if(vts_ptt_srpt->nr_of_srpts > info_length / sizeof(*data)) {
+ fprintf(stderr, "libdvdread: PTT search table too small.\n");
+ goto fail;
+ }
for(i = 0; i < vts_ptt_srpt->nr_of_srpts; i++) {
B2N_32(data[i]);
/* assert(data[i] + sizeof(ptt_info_t) <= vts_ptt_srpt->last_byte + 1);