From 93b896eb4edc035d9ccc56a680a34e83aa18bb42 Mon Sep 17 00:00:00 2001 From: Sangchul Lee Date: Thu, 22 Sep 2022 22:39:31 +0900 Subject: [PATCH] webrtcbin: Fix pointer dereference before null check Part-of: --- .../gst-plugins-bad/ext/webrtc/gstwebrtcbin.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c index ea33864cb5..54a8c8853f 100644 --- a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c +++ b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c @@ -6366,6 +6366,12 @@ _set_description_task (GstWebRTCBin * webrtc, struct set_description *sd) continue; } + if (!pad->trans) { + GST_LOG_OBJECT (pad, "doesn't have a transceiver"); + tmp = tmp->next; + continue; + } + if (pad->trans->mline >= gst_sdp_message_medias_len (sd->sdp->sdp)) { GST_DEBUG_OBJECT (pad, "not mentioned in this description. Skipping"); tmp = tmp->next; @@ -6382,12 +6388,6 @@ _set_description_task (GstWebRTCBin * webrtc, struct set_description *sd) continue; } - if (!pad->trans) { - GST_LOG_OBJECT (pad, "doesn't have a transceiver"); - tmp = tmp->next; - continue; - } - new_dir = pad->trans->direction; if (new_dir != GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY && new_dir != GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV) {