diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c index ae2e0a0d02..924a6d979c 100644 --- a/libavformat/sbgdec.c +++ b/libavformat/sbgdec.c @@ -1414,6 +1414,11 @@ static av_cold int sbg_read_header(AVFormatContext *avf) if (r < 0) goto fail; + if (script.end_ts != AV_NOPTS_VALUE && script.end_ts < script.start_ts) { + r = AVERROR_INVALIDDATA; + goto fail; + } + st = avformat_new_stream(avf, NULL); if (!st) return AVERROR(ENOMEM);