also adding the integer overflow check to intersects_range
@@ -75,12 +75,16 @@ impl MemoryRange for Range<u32> {
/// Returns true if `self` intersects `range` partially.
fn intersects_range(&self, range: &Range<u32>) -> bool {
+ if range.end == 0 {
+ false
+ } else {
self.contains(&range.start) && !self.contains(&(range.end - 1))
|| !self.contains(&range.start) && self.contains(&(range.end - 1))
|| self.contains_range(range)
|| range.contains_range(self)
}
}
+}
/// Declares the type of a memory region.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
