changeset 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 f08dbb15ece1
files dvdread/dvd_reader.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dvdread/dvd_reader.c	Sat Apr 19 09:34:55 2008 +0000
+++ b/dvdread/dvd_reader.c	Sat Apr 19 09:40:03 2008 +0000
@@ -971,7 +971,8 @@
                  * also error from this read will not show in ret. */
 		
 		/* Does the next part exist? If not then return now. */
-		if( !dvd_file->title_devs[ i + 1 ] ) return ret;
+		if( i + 1 >= TITLES_MAX || !dvd_file->title_devs[ i + 1 ] )
+                    return ret;
 
                 /* Read part 2 */
                 off = dvdinput_seek( dvd_file->title_devs[ i + 1 ], 0 );