[FFmpeg-devel] avformat/mxfdec: only return stream indexes which have a corresponding track

Submitted by Marton Balint on July 4, 2018, 8:30 p.m.

Details

Message ID 20180704203027.23849-1-cus@passwd.hu
State Accepted
Commit e5ff2c0c06188ff47706ce62db771b6b45f86b8c
Headers show

Commit Message

Marton Balint July 4, 2018, 8:30 p.m.
Without this check some crafted files might crash because a packet might be
demuxed which have no corresponding mxf track.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavformat/mxfdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marton Balint July 13, 2018, 9:14 p.m.
On Wed, 4 Jul 2018, Marton Balint wrote:

> Without this check some crafted files might crash because a packet might be
> demuxed which have no corresponding mxf track.

Applied.

Regards,
Marton

Patch hide | download patch | download mbox

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index b76beb962f..c52ece9655 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -423,7 +423,7 @@  static int mxf_get_stream_index(AVFormatContext *s, KLVPacket *klv, int body_sid
             return i;
     }
     /* return 0 if only one stream, for OP Atom files with 0 as track number */
-    return s->nb_streams == 1 ? 0 : -1;
+    return s->nb_streams == 1 && s->streams[0]->priv_data ? 0 : -1;
 }
 
 static int find_body_sid_by_offset(MXFContext *mxf, int64_t offset)