From 7041c8ef2c93b757e3e461374fed56c471c08403 Mon Sep 17 00:00:00 2001 From: Andrew Gunnerson Date: Sun, 17 Dec 2023 14:49:50 -0500 Subject: [PATCH] util: merge_overlapping: Skip empty and invalid ranges Signed-off-by: Andrew Gunnerson --- avbroot/src/util.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/avbroot/src/util.rs b/avbroot/src/util.rs index 1fa5fe4..e1035ec 100644 --- a/avbroot/src/util.rs +++ b/avbroot/src/util.rs @@ -70,7 +70,9 @@ where let mut result = Vec::>::new(); for section in sections { - if let Some(last) = result.last_mut() { + if section.start >= section.end { + continue; + } else if let Some(last) = result.last_mut() { if section.start <= last.end { last.end = last.end.max(section.end); continue;