mpegts: Do not call read_sl_header() when no bytes remain in the buffer.

Message ID 20120302234522.9288F5E07F@aruru.libav.org
State New
Headers show

Commit Message

Janne Grunau March 2, 2012, 11:45 p.m.
Module: libav
Branch: master
Commit: 4df369692ea8aee7094ac0f233cef8d1bee139a3

Author:    Alex Converse <alex.converse@gmail.com>
Committer: Alex Converse <alex.converse@gmail.com>
Date:      Fri Mar  2 10:12:11 2012 -0800

mpegts: Do not call read_sl_header() when no bytes remain in the buffer.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

---

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

Patch

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index b105d8c..32901a1 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -889,7 +889,7 @@  static int mpegts_push_data(MpegTSFilter *filter,
                 /* we got the full header. We parse it and get the payload */
                 pes->state = MPEGTS_PAYLOAD;
                 pes->data_index = 0;
-                if (pes->stream_type == 0x12) {
+                if (pes->stream_type == 0x12 && buf_size > 0) {
                     int sl_header_bytes = read_sl_header(pes, &pes->sl, p, buf_size);
                     pes->pes_header_size += sl_header_bytes;
                     p += sl_header_bytes;