[libdvdnav-devel] [Git][videolan/libdvdread][master] 4 commits: Don't ignore I/O errors in InternalUDFReadBlocksRaw
Jean-Baptiste Kempf
gitlab at videolan.org
Tue Feb 5 16:11:25 CET 2019
Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdread
Commits:
b1f3681b by John Stebbins at 2019-02-05T14:21:33Z
Don't ignore I/O errors in InternalUDFReadBlocksRaw
Ignoring these errors can lead to hanging in a loop for hours on damaged
images.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
- - - - -
98423d6a by Nicolas Porcel at 2019-02-05T14:29:46Z
Fix dvd burnt with Nero
Some DVD written with Nero Burning ROM have faulty IFO files that make
them unreadable with libdvdread. The condition removed is checked anyway
using the CHECK_VALUE macro.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
- - - - -
1f4136e8 by Jean-Baptiste Kempf at 2019-02-05T15:10:12Z
Fix fallthrough warning
- - - - -
34bb5af1 by Jean-Baptiste Kempf at 2019-02-05T15:10:12Z
Update Release version to 6.0.1
- - - - -
5 changed files:
- configure.ac
- src/dvd_reader.c
- src/dvd_udf.c
- src/ifo_print.c
- src/ifo_read.c
Changes:
=====================================
configure.ac
=====================================
@@ -1,7 +1,7 @@
dnl library version number
m4_define([dvdread_major], 6)
m4_define([dvdread_minor], 0)
-m4_define([dvdread_micro], 0)
+m4_define([dvdread_micro], 1)
m4_define([dvdread_version],[dvdread_major.dvdread_minor.dvdread_micro])
AC_INIT(libdvdread, dvdread_version)
=====================================
src/dvd_reader.c
=====================================
@@ -1156,13 +1156,13 @@ int InternalUDFReadBlocksRaw( const dvd_reader_t *device, uint32_t lb_number,
if( !device->dev ) {
fprintf( stderr, "libdvdread: Fatal error in block read.\n" );
- return 0;
+ return -1;
}
ret = dvdinput_seek( device->dev, (int) lb_number );
if( ret != (int) lb_number ) {
fprintf( stderr, "libdvdread: Can't seek to block %u\n", lb_number );
- return 0;
+ return ret;
}
ret = dvdinput_read( device->dev, (char *) data,
=====================================
src/dvd_udf.c
=====================================
@@ -516,6 +516,7 @@ static int UDFMapICB( dvd_reader_t *device, struct AD ICB, uint8_t *FileType,
uint32_t lbnum;
uint16_t TagID;
struct icbmap tmpmap;
+ int ret;
lbnum = partition->Start + ICB.Location;
tmpmap.lbn = lbnum;
@@ -526,10 +527,16 @@ static int UDFMapICB( dvd_reader_t *device, struct AD ICB, uint8_t *FileType,
}
do {
- if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 )
+ ret = DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 );
+ if( ret < 0 ) {
+ return ret;
+ }
+ else if( ret == 0 ) {
TagID = 0;
- else
+ }
+ else {
UDFDescriptor( LogBlock, &TagID );
+ }
if( TagID == FileEntry ) {
UDFFileEntry( LogBlock, FileType, partition, File );
@@ -564,6 +571,7 @@ static int UDFScanDir( dvd_reader_t *device, struct AD Dir, char *FileName,
uint8_t *cached_dir_base = NULL, *cached_dir;
uint32_t dir_lba;
struct AD tmpICB;
+ int ret;
/* Scan dir for ICB of file */
lbnum = partition->Start + Dir.Location;
@@ -579,10 +587,13 @@ static int UDFScanDir( dvd_reader_t *device, struct AD Dir, char *FileName,
if((cached_dir_base = malloc(dir_lba * DVD_VIDEO_LB_LEN + 2048)) == NULL)
return 0;
cached_dir = (uint8_t *)(((uintptr_t)cached_dir_base & ~((uintptr_t)2047)) + 2048);
- if( DVDReadLBUDF( device, lbnum, dir_lba, cached_dir, 0) <= 0 ) {
+ ret = DVDReadLBUDF( device, lbnum, dir_lba, cached_dir, 0);
+ if( ret <= 0 ) {
free(cached_dir_base);
cached_dir_base = NULL;
cached_dir = NULL;
+ if( ret < 0 )
+ return ret;
}
/*
if(cached_dir) {
@@ -677,6 +688,7 @@ static int UDFGetAVDP( dvd_reader_t *device,
uint32_t lastsector;
int terminate;
struct avdp_t;
+ int ret;
if(GetUDFCache(device, AVDPCache, 0, avdp))
return 1;
@@ -687,11 +699,16 @@ static int UDFGetAVDP( dvd_reader_t *device,
terminate = 0;
for(;;) {
- if( DVDReadLBUDF( device, lbnum, 1, Anchor, 0 ) > 0 ) {
- UDFDescriptor( Anchor, &TagID );
- } else {
+ ret = DVDReadLBUDF( device, lbnum, 1, Anchor, 0 );
+ if( ret < 0 ) {
+ return ret;
+ }
+ else if( ret == 0 ) {
TagID = 0;
}
+ else {
+ UDFDescriptor( Anchor, &TagID );
+ }
if (TagID != AnchorVolumeDescriptorPointer) {
/* Not an anchor */
if( terminate ) return 0; /* Final try failed */
@@ -742,7 +759,7 @@ static int UDFFindPartition( dvd_reader_t *device, int partnum,
uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~((uintptr_t)2047)) + 2048);
uint32_t lbnum, MVDS_location, MVDS_length;
uint16_t TagID;
- int i, volvalid;
+ int i, volvalid, ret;
struct avdp_t avdp;
if(!UDFGetAVDP(device, &avdp))
@@ -761,10 +778,16 @@ static int UDFFindPartition( dvd_reader_t *device, int partnum,
lbnum = MVDS_location;
do {
- if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 )
+ ret = DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 );
+ if( ret < 0 ) {
+ return ret;
+ }
+ else if( ret == 0 ) {
TagID = 0;
- else
+ }
+ else {
UDFDescriptor( LogBlock, &TagID );
+ }
if( ( TagID == PartitionDescriptor ) && ( !part->valid ) ) {
/* Partition Descriptor */
@@ -805,6 +828,7 @@ uint32_t UDFFindFile( dvd_reader_t *device, const char *filename,
struct AD RootICB, File, ICB;
char tokenline[ MAX_UDF_FILE_NAME_LEN ];
uint8_t filetype;
+ int ret;
*filesize = 0;
tokenline[0] = '\0';
@@ -820,10 +844,16 @@ uint32_t UDFFindFile( dvd_reader_t *device, const char *filename,
/* Find root dir ICB */
lbnum = partition.Start;
do {
- if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 )
+ ret = DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 );
+ if( ret < 0 ) {
+ return ret;
+ }
+ else if( ret == 0 ) {
TagID = 0;
- else
+ }
+ else {
UDFDescriptor( LogBlock, &TagID );
+ }
/* File Set Descriptor */
if( TagID == FileSetDescriptor ) /* File Set Descriptor */
@@ -886,7 +916,7 @@ static int UDFGetDescriptor( dvd_reader_t *device, int id,
uint32_t lbnum, MVDS_location, MVDS_length;
struct avdp_t avdp;
uint16_t TagID;
- int i, desc_found = 0;
+ int i, desc_found = 0, ret;
/* Find Anchor */
lbnum = 256; /* Try #1, prime anchor */
if(bufsize < DVD_VIDEO_LB_LEN)
@@ -904,10 +934,16 @@ static int UDFGetDescriptor( dvd_reader_t *device, int id,
/* Find Descriptor */
lbnum = MVDS_location;
do {
- if( DVDReadLBUDF( device, lbnum++, 1, descriptor, 0 ) <= 0 )
+ ret = DVDReadLBUDF( device, lbnum++, 1, descriptor, 0 );
+ if( ret < 0 ) {
+ return ret;
+ }
+ else if( ret == 0 ) {
TagID = 0;
- else
+ }
+ else {
UDFDescriptor( descriptor, &TagID );
+ }
if( (TagID == id) && ( !desc_found ) )
/* Descriptor */
desc_found = 1;
=====================================
src/ifo_print.c
=====================================
@@ -219,6 +219,7 @@ static void ifo_print_audio_attributes(audio_attr_t *attr) {
break;
case 2:
printf("mpeg1 ");
+ /* Falls Through. */ /* to MPEG-2 */
case 3:
printf("mpeg2ext ");
switch(attr->quantization) {
=====================================
src/ifo_read.c
=====================================
@@ -1244,8 +1244,6 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) {
= *(uint16_t*)(((char *)data) + data[i] + 4*j - VTS_PTT_SRPT_SIZE);
vts_ptt_srpt->title[i].ptt[j].pgn
= *(uint16_t*)(((char *)data) + data[i] + 4*j + 2 - VTS_PTT_SRPT_SIZE);
- if(!vts_ptt_srpt->title[i].ptt[j].pgn)
- goto fail;
}
}
View it on GitLab: https://code.videolan.org/videolan/libdvdread/compare/3ba6d4eb22acb316eaec5de907ca815f6a6415c7...34bb5af1400606fc7cd15e5770d149f38adc8f51
--
View it on GitLab: https://code.videolan.org/videolan/libdvdread/compare/3ba6d4eb22acb316eaec5de907ca815f6a6415c7...34bb5af1400606fc7cd15e5770d149f38adc8f51
You're receiving this email because of your account on code.videolan.org.
More information about the libdvdnav-devel
mailing list