--- ./src/dvdbackup.c.org 2007-10-20 02:03:52.000000000 +0900 +++ ./src/dvdbackup.c 2007-10-20 02:30:09.000000000 +0900 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -1985,6 +1986,13 @@ vts_title = titles_info->titles[titles - 1].vts_title; + if (start_chapter > titles_info->titles[titles - 1].chapters && + end_chapter > titles_info->titles[titles - 1].chapters) { + fprintf(stderr, "Overflowed the start_chapter; only %d chapters in %d title\n", start_chapter,titles); + fprintf(stderr, "Overflowed the end_chapter; only %d chapters in %d title\n", end_chapter,titles); + return(1); + } + if (end_chapter > titles_info->titles[titles - 1].chapters) { end_chapter = titles_info->titles[titles - 1].chapters; fprintf(stderr, "Truncated the end_chapter; only %d chapters in %d title\n", end_chapter,titles); @@ -1992,7 +2000,7 @@ if (start_chapter > titles_info->titles[titles - 1].chapters) { start_chapter = titles_info->titles[titles - 1].chapters; - fprintf(stderr, "Truncated the end_chapter; only %d chapters in %d title\n", end_chapter,titles); + fprintf(stderr, "Truncated the start_chapter; only %d chapters in %d title\n", start_chapter,titles); }