aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-08-31 11:29:54 +0200
committerAlex Auvolat <alex@adnab.me>2023-08-31 11:29:54 +0200
commitf579d6d9b42ef03d639cc7356b2fa15265074120 (patch)
treea33c28c96c8e764c5e4ea7bfef37f5811d5f9638
parenta00a52633f7846c3683da65a07266a03f88b0f74 (diff)
downloadgarage-f579d6d9b42ef03d639cc7356b2fa15265074120.tar.gz
garage-f579d6d9b42ef03d639cc7356b2fa15265074120.zip
lifecycle worker: fix potential inifinite loop
-rw-r--r--src/model/s3/lifecycle_worker.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/model/s3/lifecycle_worker.rs b/src/model/s3/lifecycle_worker.rs
index 53c84a17..0747ffb8 100644
--- a/src/model/s3/lifecycle_worker.rs
+++ b/src/model/s3/lifecycle_worker.rs
@@ -193,7 +193,10 @@ impl Worker for LifecycleWorker {
if skip == Skip::SkipBucket {
let bucket_id_len = object.bucket_id.as_slice().len();
assert_eq!(pos.get(..bucket_id_len), Some(object.bucket_id.as_slice()));
- *pos = [&pos[..bucket_id_len], &[0xFFu8][..]].concat();
+ *pos = std::cmp::max(
+ next_pos,
+ [&pos[..bucket_id_len], &[0xFFu8][..]].concat(),
+ );
} else {
*pos = next_pos;
}