diff options
author | Alex Auvolat <alex@adnab.me> | 2023-08-31 11:29:54 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-08-31 11:29:54 +0200 |
commit | f579d6d9b42ef03d639cc7356b2fa15265074120 (patch) | |
tree | a33c28c96c8e764c5e4ea7bfef37f5811d5f9638 /src/model | |
parent | a00a52633f7846c3683da65a07266a03f88b0f74 (diff) | |
download | garage-f579d6d9b42ef03d639cc7356b2fa15265074120.tar.gz garage-f579d6d9b42ef03d639cc7356b2fa15265074120.zip |
lifecycle worker: fix potential inifinite loop
Diffstat (limited to 'src/model')
-rw-r--r-- | src/model/s3/lifecycle_worker.rs | 5 |
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; } |