# HG changeset patch # User eugeni # Date 1178060661 0 # Node ID 20be83485595db27c0b8535773ce6928af2b3d55 # Parent 09a78a8c1c0442d6abe9a49cdf99c0fbcd1c179f 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. diff -r 09a78a8c1c04 -r 20be83485595 libmpdemux/demux_mkv.c --- 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); }