[FFmpeg-devel] [PATCH] mxfdec: fix NULL pointer dereference

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Sat Nov 5 01:20:21 EET 2016


Metadata streams have priv_data set to NULL.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavformat/mxfdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index d2166ee..a1a79ce 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -391,7 +391,7 @@ static int mxf_get_stream_index(AVFormatContext *s, KLVPacket *klv)
     for (i = 0; i < s->nb_streams; i++) {
         MXFTrack *track = s->streams[i]->priv_data;
         /* SMPTE 379M 7.3 */
-        if (!memcmp(klv->key + sizeof(mxf_essence_element_key), track->track_number, sizeof(track->track_number)))
+        if (track && !memcmp(klv->key + sizeof(mxf_essence_element_key), track->track_number, sizeof(track->track_number)))
             return i;
     }
     /* return 0 if only one stream, for OP Atom files with 0 as track number */
-- 
2.10.1


More information about the ffmpeg-devel mailing list