[vlc-commits] mkv: avoid potential NULL memory comparison

Rémi Denis-Courmont git at videolan.org
Mon Aug 25 20:32:31 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 25 21:31:15 2014 +0300| [9fea6f98baaa7285e3d561547ee7c436b35bbaa7] | committer: Rémi Denis-Courmont

mkv: avoid potential NULL memory comparison

memcmp(NULL, b, 0) and memcpy(a, NULL, 0) are undefined in ISO C.

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

 modules/demux/mkv/virtual_segment.cpp |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index 7d484da..a588cdc 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -663,7 +663,7 @@ void virtual_segment_c::ChangeSegment( matroska_segment_c * p_old, matroska_segm
                     ( p_nfmt->i_priority == p_ofmt->i_priority ) &&
                     ( p_nfmt->i_bitrate == p_ofmt->i_bitrate ) &&
                     ( p_nfmt->i_extra == p_ofmt->i_extra ) &&
-                    ( (!p_nfmt->p_extra && !p_ofmt->p_extra) ||
+                    ( p_nfmt->i_extra == 0 ||
                       !memcmp( p_nfmt->p_extra, p_ofmt->p_extra, p_nfmt->i_extra ) ) &&
                     !strcasecmp( p_nfmt->psz_language, p_ofmt->psz_language ) &&
                     ( ( p_nfmt->i_cat == AUDIO_ES &&



More information about the vlc-commits mailing list