changeset 23187:20be83485595

Fix NULL pointer dereference in demux_mkv that happens when demux_mkv_get_sub_lang (or demux_mkv_get_audio_lang) is called with an invalid track number.
author eugeni
date Tue, 01 May 2007 23:04:21 +0000
parents 09a78a8c1c04
children 6431b46104b7
files libmpdemux/demux_mkv.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.c	Tue May 01 22:08:26 2007 +0000
+++ b/libmpdemux/demux_mkv.c	Tue May 01 23:04:21 2007 +0000
@@ -3738,7 +3738,7 @@
 {
   mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
   mkv_track_t *track = demux_mkv_find_track_by_num (mkv_d, track_num, MATROSKA_TRACK_SUBTITLE);
-  if (track->language && strcmp(track->language, "und"))
+  if (track && track->language && strcmp(track->language, "und"))
     strlcpy(lang, track->language, maxlen);
 }
 
@@ -3758,7 +3758,7 @@
 {
   mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
   mkv_track_t *track = demux_mkv_find_track_by_num (mkv_d, track_num, MATROSKA_TRACK_AUDIO);
-  if (track->language && strcmp(track->language, "und"))
+  if (track && track->language && strcmp(track->language, "und"))
     strlcpy(lang, track->language, maxlen);
 }