[FFmpeg-cvslog] avformat/mpegts: Reset local nb_prg on add_program() failure
Michael Niedermayer
git at videolan.org
Sun Apr 14 20:35:24 EEST 2024
ffmpeg | branch: release/5.1 | Michael Niedermayer <michael at niedermayer.cc> | Tue Feb 27 02:07:28 2024 +0100| [808ec6ccfa0733093ed59be2398965d917109b9c] | committer: Michael Niedermayer
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 at niedermayer.cc>
(cherry picked from commit cb9752d897de17212a7a3ce54ad3e16b377b22c0)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=808ec6ccfa0733093ed59be2398965d917109b9c
---
libavformat/mpegts.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 8a3436f2be..edbf126666 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2597,7 +2597,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;
More information about the ffmpeg-cvslog
mailing list