[vlc-commits] demux/mkv: matroska_segment_C::ParseTrackEntry: prevent potential null-dereference
Filip Roséen
git at videolan.org
Thu May 18 18:09:27 CEST 2017
vlc | branch: master | Filip Roséen <filip at atch.se> | Thu May 18 12:19:33 2017 +0200| [1108b6b89345b8e3f872287b5f734f4dbeb7a3cf] | committer: Rémi Denis-Courmont
demux/mkv: matroska_segment_C::ParseTrackEntry: prevent potential null-dereference
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1108b6b89345b8e3f872287b5f734f4dbeb7a3cf
---
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() );
}
More information about the vlc-commits
mailing list