From 58a60392c23bee21210f9497223dac2fd47c2ab2 Mon Sep 17 00:00:00 2001 From: yanchith Date: Sun, 17 May 2020 12:17:36 +0200 Subject: [PATCH] Fix possible out-of-bounds when trace log level enabled Also, even when there was no out-of-bounds access, the log statement talked about an incorrect submission index. --- wgpu-core/src/command/allocator.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wgpu-core/src/command/allocator.rs b/wgpu-core/src/command/allocator.rs index 07fd7c2e4e..4a882b91d1 100644 --- a/wgpu-core/src/command/allocator.rs +++ b/wgpu-core/src/command/allocator.rs @@ -27,10 +27,10 @@ impl CommandPool { fn maintain(&mut self, lowest_active_index: SubmissionIndex) { for i in (0..self.pending.len()).rev() { if self.pending[i].1 < lowest_active_index { - let cmd_buf = self.pending.swap_remove(i).0; + let (cmd_buf, index) = self.pending.swap_remove(i); log::trace!( "recycling comb submitted in {} when {} is lowest active", - self.pending[i].1, + index, lowest_active_index, ); self.recycle(cmd_buf);