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

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


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

mpeg_ts: fix potential array off by one

(cherry picked from commit af878173a3a4d73ef9d7ac00e9196894f8231be8)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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