[FFmpeg-cvslog] mpegts: prevent get_bits64() from reading nonsense at the end.

Michael Niedermayer git at videolan.org
Sat Mar 3 21:25:03 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Mar  3 21:02:17 2012 +0100| [4a310a19dea268b541a099515d73fda04dc642e9] | committer: Michael Niedermayer

mpegts: prevent get_bits64() from reading nonsense at the end.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a310a19dea268b541a099515d73fda04dc642e9
---

 libavformat/mpegts.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 3d825fe..e6c353d 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -693,6 +693,9 @@ static void new_pes_packet(PESContext *pes, AVPacket *pkt)
 static uint64_t get_bits64(GetBitContext *gb, int bits)
 {
     uint64_t ret = 0;
+
+    if (get_bits_left(gb) < bits)
+        return AV_NOPTS_VALUE;
     while (bits > 17) {
         ret <<= 17;
         ret |= get_bits(gb, 17);



More information about the ffmpeg-cvslog mailing list