diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c index 7d434328b7..0b364430f6 100644 --- a/libavfilter/vf_signature.c +++ b/libavfilter/vf_signature.c @@ -386,6 +386,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 = avpriv_fopen_utf8(filename, "w"); if (!f) { int err = AVERROR(EINVAL); diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 95e44d3736..e482690fc9 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -3234,7 +3234,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;