Opened 13 years ago
#1981 new defect
libdvdread4 does not handle unicode filenames correctly
Reported by: | Owned by: | reimar | |
---|---|---|---|
Priority: | normal | Component: | demuxer |
Version: | HEAD | Severity: | normal |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Reproduced by developer: | no | Analyzed by developer: | no |
Description
This problem was discovered on the region 1 "Thor" DVD. The VIDEO_TS directory has two hidden files. One of these files has the unicode name "\001v\001i\001d\001e\001o\001_\001t\001s\001.\001 i\001f\001o", or "video_ts.ifo" except with a binary "1" (instead of "0") as the MSB of each unicode character.
libdvdread4 processes unicode by (incorrectly) stripping off the MSB, leaving "video_ts.ifo". This causes problems because there are two versions of "VIDEO_TS.IFO" and the second hidden/unicode one points to bogus data. Unfortunately libdvdread4 uses the second one and since it has the wrong signature this generates an error and mplayer crashes.
I replaced the function Unicodedecode() in dvd_udf.c from the libdvdread4 library and it seems to fix it. The suggested fix follows.
jim
static int
Unicodedecode(uint8_t *data, int len, char *target)
{
len--;
data++;
if (data[-1] == 8 )
memcpy(target, data, len);
else if (data[-1] == 16) {
int i;
for (i = 0; i < len; i++) {
if (data[i*2] == 0)
target[i] = data[i*2+1];
else
target[i] = 0;
}
}
target[len] = '\0';
return 0;
}