From 586bb739120075323e7f9bbbc2ca413f5f6de432 Mon Sep 17 00:00:00 2001 From: "LeiZhi.Mai" Date: Fri, 1 Dec 2023 10:44:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=85=BC=E5=AE=B9webrtc=20offer=20sdp?= =?UTF-8?q?=E4=B8=AD=E9=87=8D=E5=A4=8D=E8=A1=8C=E7=9A=84=E6=83=85=E5=86=B5?= =?UTF-8?q?=20(#3038)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/Sdp.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/webrtc/Sdp.cpp b/webrtc/Sdp.cpp index 7051e42f..89a9092c 100644 --- a/webrtc/Sdp.cpp +++ b/webrtc/Sdp.cpp @@ -267,16 +267,23 @@ void RtcSessionSdp::parse(const string &str) { static auto flag = registerAllItem(); RtcSdpBase *media = nullptr; auto lines = split(str, "\n"); - for(auto &line : lines){ + std::set line_set; + for (auto &line : lines) { trim(line); - if(line.size() < 3 || line[1] != '='){ + if (line.size() < 3 || line[1] != '=') { continue; } + + if (!line_set.emplace(line).second) { + continue; + } + auto key = line.substr(0, 1); auto value = line.substr(2); if (!strcasecmp(key.data(), "m")) { medias.emplace_back(RtcSdpBase()); media = &medias.back(); + line_set.clear(); } SdpItem::Ptr item; From a8e2d602cb2faefadaf165b74e05c520c439d753 Mon Sep 17 00:00:00 2001 From: yujitai Date: Fri, 1 Dec 2023 10:45:24 +0800 Subject: [PATCH 2/2] =?UTF-8?q?RTC:=20=E4=BF=AE=E5=A4=8DTWCC=20feedback=20?= =?UTF-8?q?rtcp=E8=A7=A3=E6=9E=90status=20chunk=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#3059)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在解析packet status chunk的时候使用了uint8_t类型的循环变量,如果反馈的包数量超过255,那么解析会陷入循环,出现异常 --- src/Rtcp/RtcpFCI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Rtcp/RtcpFCI.cpp b/src/Rtcp/RtcpFCI.cpp index 8ed27670..6fcdcba9 100644 --- a/src/Rtcp/RtcpFCI.cpp +++ b/src/Rtcp/RtcpFCI.cpp @@ -432,7 +432,7 @@ FCI_TWCC::TwccPacketStatus FCI_TWCC::getPacketChunkList(size_t total_size) const CHECK(ptr < end); auto seq = getBaseSeq(); auto rtp_count = getPacketCount(); - for (uint8_t i = 0; i < rtp_count;) { + for (uint16_t i = 0; i < rtp_count;) { CHECK(ptr + RunLengthChunk::kSize <= end); RunLengthChunk *chunk = (RunLengthChunk *)ptr; if (!chunk->type) {