[vlc-commits] mpeg_ts: fix potential array off by one

Rémi Duraffort git at videolan.org
Fri Aug 9 10:24:36 CEST 2013


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Thu Aug  8 18:52:33 2013 +0200| [af878173a3a4d73ef9d7ac00e9196894f8231be8] | committer: Jean-Baptiste Kempf

mpeg_ts: fix potential array off by one

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

 modules/mux/mpeg/ts.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index 2cfd8cf..d514f5c 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -557,10 +557,10 @@ static int Open( vlc_object_t *p_this )
         {
             p_sys->pmtmap[p_sys->i_pmtslots].i_pid = i_pid;
             p_sys->pmtmap[p_sys->i_pmtslots].i_prog = p_sys->i_num_pmt - 1;
-            if ( ++p_sys->i_pmtslots > MAX_PMT_PID )
+            if ( ++p_sys->i_pmtslots >= MAX_PMT_PID )
             {
                 msg_Err( p_mux, "Number of pids in PMT > %d", MAX_PMT_PID );
-                p_sys->i_pmtslots = MAX_PMT_PID;
+                p_sys->i_pmtslots = MAX_PMT_PID - 1;
             }
         }
     }
@@ -633,7 +633,7 @@ static int Open( vlc_object_t *p_this )
 
             if( i_pid == 0 )
             {
-                if( i > MAX_PMT )
+                if( i >= MAX_PMT )
                     msg_Err( p_mux, "Number of PMTs > maximum (%d)", MAX_PMT );
             }
             else



More information about the vlc-commits mailing list