Loading changes/bug27177 0 → 100644 +4 −0 Original line number Diff line number Diff line o Minor bugfixes (rust): - Protover parsing was accepting the presence of whitespace in version strings, which the C implementation would choke on, e.g. "Desc=1\t,2". Fixes bug 27177; bugfix on 0.3.3.5-rc. src/rust/protover/protoset.rs +10 −5 Original line number Diff line number Diff line Loading @@ -341,11 +341,9 @@ impl FromStr for ProtoSet { /// ``` fn from_str(version_string: &str) -> Result<Self, Self::Err> { let mut pairs: Vec<(Version, Version)> = Vec::new(); let pieces: ::std::str::Split<char> = version_string.trim().split(','); for piece in pieces { let p: &str = piece.trim(); let pieces: ::std::str::Split<char> = version_string.split(','); for p in pieces { if p.is_empty() { continue; } else if p.contains('-') { Loading @@ -370,7 +368,7 @@ impl FromStr for ProtoSet { pairs.push((v, v)); } } // If we were passed in an empty string, or a bunch of whitespace, or // If we were passed in an empty string, or // simply a comma, or a pile of commas, then return an empty ProtoSet. if pairs.len() == 0 { return Ok(ProtoSet::default()); Loading Loading @@ -561,6 +559,13 @@ mod test { assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("%=")); } #[test] fn test_versions_from_str_whitespace() { assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("1,2\n")); assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("1\r,2")); assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("1,\t2")); } #[test] fn test_versions_from_str_overlap() { assert_eq!(Err(ProtoverError::Overlap), ProtoSet::from_str("1-3,2-4")); Loading Loading
changes/bug27177 0 → 100644 +4 −0 Original line number Diff line number Diff line o Minor bugfixes (rust): - Protover parsing was accepting the presence of whitespace in version strings, which the C implementation would choke on, e.g. "Desc=1\t,2". Fixes bug 27177; bugfix on 0.3.3.5-rc.
src/rust/protover/protoset.rs +10 −5 Original line number Diff line number Diff line Loading @@ -341,11 +341,9 @@ impl FromStr for ProtoSet { /// ``` fn from_str(version_string: &str) -> Result<Self, Self::Err> { let mut pairs: Vec<(Version, Version)> = Vec::new(); let pieces: ::std::str::Split<char> = version_string.trim().split(','); for piece in pieces { let p: &str = piece.trim(); let pieces: ::std::str::Split<char> = version_string.split(','); for p in pieces { if p.is_empty() { continue; } else if p.contains('-') { Loading @@ -370,7 +368,7 @@ impl FromStr for ProtoSet { pairs.push((v, v)); } } // If we were passed in an empty string, or a bunch of whitespace, or // If we were passed in an empty string, or // simply a comma, or a pile of commas, then return an empty ProtoSet. if pairs.len() == 0 { return Ok(ProtoSet::default()); Loading Loading @@ -561,6 +559,13 @@ mod test { assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("%=")); } #[test] fn test_versions_from_str_whitespace() { assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("1,2\n")); assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("1\r,2")); assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("1,\t2")); } #[test] fn test_versions_from_str_overlap() { assert_eq!(Err(ProtoverError::Overlap), ProtoSet::from_str("1-3,2-4")); Loading