[FFmpeg-cvslog] avformat/mpegts: Reset local nb_prg on add_program() failure
Michael Niedermayer
git at videolan.org
Wed Apr 3 15:44:14 EEST 2024
ffmpeg | branch: release/7.0 | Michael Niedermayer <michael at niedermayer.cc> | Tue Feb 27 02:07:28 2024 +0100| [cbbe688434e2aac4685e36036e413c026053ef47] | 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=cbbe688434e2aac4685e36036e413c026053ef47
---
libavformat/mpegts.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index de7a3c8b45..320926248b 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2605,7 +2605,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