From ee91fe7536389d7f5a5ea5f5d93357242205f3a8 Mon Sep 17 00:00:00 2001 From: Chris Barnes Date: Wed, 6 Dec 2023 14:00:12 +0000 Subject: [PATCH] object_store careful range slicing Ranges requested beyond the length of the resource can no longer cause panics in the `coalesce_ranges` function. --- object_store/src/util.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object_store/src/util.rs b/object_store/src/util.rs index fd86ba7366b..15bbbc76c3a 100644 --- a/object_store/src/util.rs +++ b/object_store/src/util.rs @@ -124,7 +124,7 @@ where let start = range.start - fetch_range.start; let end = range.end - fetch_range.start; - fetch_bytes.slice(start..end) + fetch_bytes.slice(start..end.min(fetch_bytes.len())) }) .collect()) }