[vlc-commits] demux: ts: reject incorrect sized packets

Francois Cartegnie git at videolan.org
Thu Dec 22 13:51:44 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 22 13:36:23 2016 +0100| [d9d6a959409396978cea58d63df51d75d8c92fae] | committer: Francois Cartegnie

demux: ts: reject incorrect sized packets

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d9d6a959409396978cea58d63df51d75d8c92fae
---

 modules/demux/mpeg/ts.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 3f61744..a7091e2 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -616,6 +616,13 @@ static int Demux( demux_t *p_demux )
             p_sys->b_start_record = false;
         }
 
+        /* Early reject truncated packets from hw devices */
+        if( unlikely(p_pkt->i_buffer < TS_PACKET_SIZE_188) )
+        {
+            block_Release( p_pkt );
+            continue;
+        }
+
         /* Parse the TS packet */
         ts_pid_t *p_pid = GetPID( p_sys, PIDGet( p_pkt ) );
 
@@ -1933,6 +1940,12 @@ static int ProbeChunk( demux_t *p_demux, int i_program, bool b_end, int64_t *pi_
             break;
         }
 
+        if( p_pkt->i_size < TS_PACKET_SIZE_188 )
+        {
+            block_Release( p_pkt );
+            continue;
+        }
+
         const int i_pid = PIDGet( p_pkt );
         ts_pid_t *p_pid = GetPID(p_sys, i_pid);
 



More information about the vlc-commits mailing list