comparison dvdread/dvd_reader.c @ 336:63aad8298f28 src

prevent access to index ouf of bounds when iterating over titles; patch by Erik Hovland - erik hovland org
author nicodvb
date Sat, 19 Apr 2008 09:40:03 +0000
parents 0bfe718f75e8
children eea1e72ea1dd
comparison
equal deleted inserted replaced
335:0bfe718f75e8 336:63aad8298f28
969 if( ret < 0 ) return ret; 969 if( ret < 0 ) return ret;
970 /* FIXME: This is wrong if i is the last file in the set. 970 /* FIXME: This is wrong if i is the last file in the set.
971 * also error from this read will not show in ret. */ 971 * also error from this read will not show in ret. */
972 972
973 /* Does the next part exist? If not then return now. */ 973 /* Does the next part exist? If not then return now. */
974 if( !dvd_file->title_devs[ i + 1 ] ) return ret; 974 if( i + 1 >= TITLES_MAX || !dvd_file->title_devs[ i + 1 ] )
975 return ret;
975 976
976 /* Read part 2 */ 977 /* Read part 2 */
977 off = dvdinput_seek( dvd_file->title_devs[ i + 1 ], 0 ); 978 off = dvdinput_seek( dvd_file->title_devs[ i + 1 ], 0 );
978 if( off < 0 || off != 0 ) { 979 if( off < 0 || off != 0 ) {
979 fprintf( stderr, "libdvdread: Can't seek to block %d\n", 980 fprintf( stderr, "libdvdread: Can't seek to block %d\n",