Bug 1432931: Added sanity check for simulcast send rid. r=bwc

Added sanity check to check if the send rid in simulcast is defined by any send rid.

MozReview-Commit-ID: GISzaQqdqBI

--HG--
extra : rebase_source : 32416045cdb8c96dff72ee74d1d84121323d358f
This commit is contained in:
Johannes Willbold 2018-06-28 10:55:50 -07:00
Родитель 530491bdbd
Коммит ac43f2bc5c
2 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -3737,7 +3737,6 @@ TEST_P(NewSdpTest, CheckMalformedImageattr)
}
TEST_P(NewSdpTest, ParseInvalidSimulcastNoSuchSendRid) {
SKIP_TEST_WITH_RUST_PARSER; // See Bug 1432931
ParseSdp("v=0" CRLF
"o=- 4294967296 2 IN IP4 127.0.0.1" CRLF
"s=SIP Call" CRLF

Просмотреть файл

@ -699,6 +699,12 @@ fn sanity_check_sdp_session(session: &SdpSession) -> Result<(), SdpParserError>
_ => None,
}
}).collect();
let send_rids:Vec<&str> = rids.iter().filter_map(|rid| {
match rid.direction {
SdpSingleDirection::Send => Some(rid.id.as_str()),
_ => None,
}
}).collect();
for rid_format in rids.iter().flat_map(|rid| &rid.formats) {
@ -718,7 +724,6 @@ fn sanity_check_sdp_session(session: &SdpSession) -> Result<(), SdpParserError>
if let Some(&SdpAttribute::Simulcast(ref simulcast)) =
msection.get_attribute(SdpAttributeType::Simulcast) {
// This is already a closure as the next Bug 1432931 will require the same procedure
let check_defined_rids = |simulcast_version_list: &Vec<SdpAttributeSimulcastVersion>,
rid_ids: &[&str]| -> Result<(),SdpParserError> {
for simulcast_rid in simulcast_version_list.iter().flat_map(|x| &x.ids) {
@ -730,7 +735,8 @@ fn sanity_check_sdp_session(session: &SdpSession) -> Result<(), SdpParserError>
Ok(())
};
check_defined_rids(&simulcast.receive, &recv_rids)?
check_defined_rids(&simulcast.receive, &recv_rids)?;
check_defined_rids(&simulcast.send, &send_rids)?;
}
}