rtp: Make sure priv_data is set before reading it
authorMartin Storsjö <martin@martin.st>
Wed, 23 Jan 2013 19:38:41 +0000 (21:38 +0200)
committerMartin Storsjö <martin@martin.st>
Thu, 24 Jan 2013 09:56:43 +0000 (11:56 +0200)
This fixes crashes with muxing H263 into RTSP.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit e90820d4f815c15796e642467cdddbad755212a2)

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/rtp.c

index 38b2348..9a7d44b 100644 (file)
@@ -108,7 +108,7 @@ int ff_rtp_get_payload_type(AVFormatContext *fmt,
     for (i = 0; AVRtpPayloadTypes[i].pt >= 0; ++i)
         if (AVRtpPayloadTypes[i].codec_id == codec->codec_id) {
             if (codec->codec_id == AV_CODEC_ID_H263 && (!fmt ||
-                !fmt->oformat->priv_class ||
+                !fmt->oformat->priv_class || !fmt->priv_data ||
                 !av_opt_flag_is_set(fmt->priv_data, "rtpflags", "rfc2190")))
                 continue;
             /* G722 has 8000 as nominal rate even if the sample rate is 16000,