[vlc-commits] ts: avoid undefined memcmp(NULL, NULL, 0)

Rémi Denis-Courmont git at videolan.org
Tue Aug 25 20:33:18 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug 25 21:23:45 2015 +0300| [1defacfacfd776e2a2c3371f58185748ba2a232a] | committer: Rémi Denis-Courmont

ts: avoid undefined memcmp(NULL, NULL, 0)

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

 modules/demux/mpeg/ts.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 90e4637..67a12e6 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -5348,8 +5348,10 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
                 /* p_pes points to a tmp pes */
                 if( !es_format_IsSimilar( &pespid->u.p_pes->es.fmt, &p_pes->es.fmt ) ||
                     pespid->u.p_pes->es.fmt.i_extra != p_pes->es.fmt.i_extra ||
-                    memcmp( pespid->u.p_pes->es.fmt.p_extra, p_pes->es.fmt.p_extra,
-                            p_pes->es.fmt.i_extra ) ||
+                    ( pespid->u.p_pes->es.fmt.i_extra > 0 &&
+                      memcmp( pespid->u.p_pes->es.fmt.p_extra,
+                              p_pes->es.fmt.p_extra,
+                              p_pes->es.fmt.i_extra ) ) ||
                     pespid->u.p_pes->extra_es.i_size != p_pes->extra_es.i_size ||
                     !!pespid->u.p_pes->es.fmt.psz_language != !!p_pes->es.fmt.psz_language ||
                     ( pespid->u.p_pes->es.fmt.psz_language && p_pes->es.fmt.psz_language &&



More information about the vlc-commits mailing list