avformat/mpegts: Reset local nb_prg on add_program() failure

add_program() will deallocate the whole array on failure so
we must clear nb_prgs

Fixes: null pointer dereference
Fixes: crash-35a3b39ddcc5babeeb005b7399a3a1217c8781bc

Found-by: Catena cyber
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit cb9752d897)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
release/6.1
Michael Niedermayer 11 months ago
parent 93d6513bbe
commit 2da196b39a
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 3
      libavformat/mpegts.c

@ -2604,7 +2604,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;

Loading…
Cancel
Save