[FFmpeg-devel] [PATCH] matroskadec: check s->streams[k] before using it

Michael Niedermayer michaelni at gmx.at
Mon May 4 12:39:30 CEST 2015


On Sun, May 03, 2015 at 11:55:20PM +0200, Andreas Cadhalpun wrote:
> This fixes a segmentation fault.
> 
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> ---
>  libavformat/matroskadec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index 27d184e..31723b3 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -2012,7 +2012,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
>                  snprintf(buf, sizeof(buf), "%s_%d",
>                           ff_matroska_video_stereo_plane[planes[j].type], i);
>                  for (k=0; k < matroska->tracks.nb_elem; k++)
> -                    if (planes[j].uid == tracks[k].uid) {
> +                    if (planes[j].uid == tracks[k].uid && s->streams[k]) {
>                          av_dict_set(&s->streams[k]->metadata,

i suspect the code should be using tracks[k].stream instead of
s->streams[k]

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150504/ee570851/attachment.asc>


More information about the ffmpeg-devel mailing list