avformat/sbgdec: Check for negative duration

Fixes: signed integer overflow: 9223372036854775807 - -8000000 cannot be represented in type 'long'
Fixes: 62276/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-5133181743136768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-03-26 00:39:49 +01:00
parent 878625812f
commit 0bed22d597
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -387,7 +387,7 @@ static int parse_options(struct sbg_parser *p)
case 'L': case 'L':
FORWARD_ERROR(parse_optarg(p, opt, &oarg)); FORWARD_ERROR(parse_optarg(p, opt, &oarg));
r = str_to_time(oarg.s, &p->scs.opt_duration); 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), snprintf(p->err_msg, sizeof(p->err_msg),
"syntax error for option -L"); "syntax error for option -L");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;