[vlc-devel] [PATCH] demux/mkv: matroska_segment_C::ParseTrackEntry: prevent potential null-dereference
Filip Roséen
filip at atch.se
Thu May 18 12:19:33 CEST 2017
---
modules/demux/mkv/matroska_segment_parse.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index f5a4ca349f..38195c265a 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -396,7 +396,10 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
if( vars.tk->i_extra_data > 0 )
{
vars.tk->p_extra_data = static_cast<uint8_t*>( malloc( vars.tk->i_extra_data ) );
- memcpy( vars.tk->p_extra_data, cpriv.GetBuffer(), vars.tk->i_extra_data );
+
+ if( likely( vars.tk->p_extra_data ) )
+ memcpy( vars.tk->p_extra_data, cpriv.GetBuffer(),
+ vars.tk->i_extra_data );
}
debug( vars, "Track CodecPrivate size=%" PRId64, cpriv.GetSize() );
}
--
2.12.2
More information about the vlc-devel
mailing list