From fa6fa44a3c499ce7eb35fdeb52bed431c3b47780 Mon Sep 17 00:00:00 2001 From: jstebbins Date: Mon, 26 Sep 2011 20:37:46 +0000 Subject: Fix for DVD's that have broken udf filenames A new obfuscation technique it to add UDF-16 filenames that have junk in the high byte and things like "VIDEO_TS.IFO" in the low byte. libdvdread throws away the high byte which results in references to the bogus copy of the file. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4252 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- contrib/libdvdread/A01-bogus-udf-filename.patch | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 contrib/libdvdread/A01-bogus-udf-filename.patch (limited to 'contrib/libdvdread') diff --git a/contrib/libdvdread/A01-bogus-udf-filename.patch b/contrib/libdvdread/A01-bogus-udf-filename.patch new file mode 100644 index 000000000..d9a3b2103 --- /dev/null +++ b/contrib/libdvdread/A01-bogus-udf-filename.patch @@ -0,0 +1,37 @@ +Index: dvd_udf.c +=================================================================== +--- libdvdread/src/dvd_udf.c (revision 1233) ++++ libdvdread/src/dvd_udf.c (working copy) +@@ -329,16 +329,17 @@ + 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 ) +@@ -490,8 +491,9 @@ + 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); + } + + -- cgit v1.2.3