diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c index bc2469afd1..e60eb1481e 100644 --- a/libavformat/sbgdec.c +++ b/libavformat/sbgdec.c @@ -387,7 +387,7 @@ static int parse_options(struct sbg_parser *p) case 'L': FORWARD_ERROR(parse_optarg(p, opt, &oarg)); r = str_to_time(oarg.s, &p->scs.opt_duration); - if (oarg.e != oarg.s + r) { + if (oarg.e != oarg.s + r || p->scs.opt_duration < 0) { snprintf(p->err_msg, sizeof(p->err_msg), "syntax error for option -L"); return AVERROR_INVALIDDATA;