From 78b56e34ffd03cbf944897fa905cc788ef076518 Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Tue, 10 Oct 2023 14:34:29 +0200 Subject: [PATCH] Use safe math when pruning statuses --- cumulus/pallets/xcmp-queue/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cumulus/pallets/xcmp-queue/src/lib.rs b/cumulus/pallets/xcmp-queue/src/lib.rs index 1cb92f595186..7ee07a7beb0a 100644 --- a/cumulus/pallets/xcmp-queue/src/lib.rs +++ b/cumulus/pallets/xcmp-queue/src/lib.rs @@ -1129,7 +1129,7 @@ impl XcmpMessageSource for Pallet { let pruned = old_statuses_len - statuses.len(); // removing an item from status implies a message being sent, so the result messages must // be no less than the pruned channels. - statuses.rotate_left(result.len() - pruned); + statuses.rotate_left(result.len().saturating_sub(pruned)); >::put(statuses);