[FFmpeg-devel] [PATCH] matroskadec: check s->streams[k] before using it
Michael Niedermayer
michaelni at gmx.at
Mon May 4 16:25:27 CEST 2015
On Mon, May 04, 2015 at 01:24:08PM +0200, Andreas Cadhalpun wrote:
> On 04.05.2015 12:39, Michael Niedermayer wrote:
> > 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]
>
> I suspected that as well, but it does not make a difference: it still crashes
> without the explicit NULL check.
> If you are sure that tracks[k].stream is correct, you can change it and the
> check accordingly.
ok
applied
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- 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/782b2b0e/attachment.asc>
More information about the ffmpeg-devel
mailing list