OSDN Git Service

sdp: Check that fmt->oformat is non-null before accessing it
authorMartin Storsjö <martin@martin.st>
Fri, 3 Jan 2014 13:47:02 +0000 (15:47 +0200)
committerMartin Storsjö <martin@martin.st>
Sat, 4 Jan 2014 23:33:46 +0000 (01:33 +0200)
This avoids crashes when avserver tries to create an SDP, since
d77f4af.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/sdp.c

index ec7e2f4..895b9d6 100644 (file)
@@ -402,7 +402,7 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
     switch (c->codec_id) {
         case AV_CODEC_ID_H264: {
             int mode = 1;
-            if (fmt && fmt->oformat->priv_class &&
+            if (fmt && fmt->oformat && fmt->oformat->priv_class &&
                 av_opt_flag_is_set(fmt->priv_data, "rtpflags", "h264_mode0"))
                 mode = 0;
             if (c->extradata_size) {