From 7a12def96f272596b0d1cdb1dcb49d62078d215b Mon Sep 17 00:00:00 2001 From: ziyugao Date: Sat, 4 May 2024 10:03:34 +0000 Subject: [PATCH] fix ffmpeg bug Signed-off-by: ziyugao --- libavfilter/vf_signature.c | 3 +++ libavformat/mpegts.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c index 32a6405e14..0bb8705d22 100644 --- a/libavfilter/vf_signature.c +++ b/libavfilter/vf_signature.c @@ -391,6 +391,9 @@ static int xml_export(AVFilterContext *ctx, StreamContext *sc, const char* filen FILE* f; unsigned int pot3[5] = { 3*3*3*3, 3*3*3, 3*3, 3, 1 }; + if (!sc->coarseend->last) + return AVERROR(EINVAL); // No frames ? + f = fopen(filename, "w"); if (!f) { int err = AVERROR(EINVAL); diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 726d17aed6..73fbcfcf5e 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -3193,7 +3193,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len FFSWAP(struct Program, ts->prg[nb_prg], ts->prg[prg_idx]); if (prg_idx >= nb_prg) nb_prg++; - } + } else + nb_prg = 0; } } ts->nb_prg = nb_prg;