forked from mirrors/gecko-dev
		
	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:
		
							parent
							
								
									530491bdbd
								
							
						
					
					
						commit
						ac43f2bc5c
					
				
					 2 changed files with 8 additions and 3 deletions
				
			
		|  | @ -3737,7 +3737,6 @@ TEST_P(NewSdpTest, CheckMalformedImageattr) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| TEST_P(NewSdpTest, ParseInvalidSimulcastNoSuchSendRid) { | TEST_P(NewSdpTest, ParseInvalidSimulcastNoSuchSendRid) { | ||||||
|   SKIP_TEST_WITH_RUST_PARSER; // See Bug 1432931
 |  | ||||||
|   ParseSdp("v=0" CRLF |   ParseSdp("v=0" CRLF | ||||||
|            "o=- 4294967296 2 IN IP4 127.0.0.1" CRLF |            "o=- 4294967296 2 IN IP4 127.0.0.1" CRLF | ||||||
|            "s=SIP Call" CRLF |            "s=SIP Call" CRLF | ||||||
|  |  | ||||||
|  | @ -699,6 +699,12 @@ fn sanity_check_sdp_session(session: &SdpSession) -> Result<(), SdpParserError> | ||||||
|               _ => None, |               _ => None, | ||||||
|           } |           } | ||||||
|         }).collect(); |         }).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) { |         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)) = |         if let Some(&SdpAttribute::Simulcast(ref simulcast)) = | ||||||
|                                             msection.get_attribute(SdpAttributeType::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>, |             let check_defined_rids = |simulcast_version_list: &Vec<SdpAttributeSimulcastVersion>, | ||||||
|                                       rid_ids: &[&str]| -> Result<(),SdpParserError> { |                                       rid_ids: &[&str]| -> Result<(),SdpParserError> { | ||||||
|                 for simulcast_rid in simulcast_version_list.iter().flat_map(|x| &x.ids) { |                 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(()) |                 Ok(()) | ||||||
|             }; |             }; | ||||||
| 
 | 
 | ||||||
|             check_defined_rids(&simulcast.receive, &recv_rids)? |             check_defined_rids(&simulcast.receive, &recv_rids)?; | ||||||
|  |             check_defined_rids(&simulcast.send, &send_rids)?; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Johannes Willbold
						Johannes Willbold