# HG changeset patch # User alex # Date 1060810348 0 # Node ID 57b5e42f6a353613d23656b2629464e01a00848e # Parent 3cf428b56cde81e1cd803903f7d56080543b0f02 Fixed segfault with (dvd://1 -chapter). Bug reported by Gabucino, initial fix by Pierre. diff -r 3cf428b56cde -r 57b5e42f6a35 libmpdemux/open.c --- a/libmpdemux/open.c Wed Aug 13 21:04:15 2003 +0000 +++ b/libmpdemux/open.c Wed Aug 13 21:32:28 2003 +0000 @@ -535,7 +535,8 @@ int dvd_parse_chapter_range(m_option_t *conf, const char *range){ const char *s; char *t; -/* conf; prevent warning from GCC */ + if (!range) + return M_OPT_MISSING_PARAM; s = range; dvd_chapter = 1; dvd_last_chapter = 0; @@ -543,26 +544,26 @@ dvd_chapter = strtol(range, &s, 10); if (range == s) { mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range); - return -1; + return M_OPT_INVALID; } } if (*s == 0) return 0; else if (*s != '-') { mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range); - return -1; + return M_OPT_INVALID; } ++s; if (*s == 0) return 0; if (! isdigit(*s)) { mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range); - return -1; + return M_OPT_INVALID; } dvd_last_chapter = strtol(s, &t, 10); if (s == t || *t) { mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range); - return -1; + return M_OPT_INVALID; } return 0; }