Blame SOURCES/0002-thin_show_metadata-Fix-out-of-bounds-access.patch

0f0231
From 691a0237809b5364117446a8a9b0cceeb0a747c1 Mon Sep 17 00:00:00 2001
0f0231
From: Ming-Hung Tsai <mtsai@redhat.com>
0f0231
Date: Tue, 1 Jun 2021 11:24:11 +0800
0f0231
Subject: [PATCH 02/10] [thin_show_metadata] Fix out-of-bounds access
0f0231
0f0231
---
0f0231
 thin-provisioning/thin_show_metadata.cc | 3 ++-
0f0231
 1 file changed, 2 insertions(+), 1 deletion(-)
0f0231
0f0231
diff --git a/thin-provisioning/thin_show_metadata.cc b/thin-provisioning/thin_show_metadata.cc
0f0231
index bdbab3f..dbc7a80 100644
0f0231
--- a/thin-provisioning/thin_show_metadata.cc
0f0231
+++ b/thin-provisioning/thin_show_metadata.cc
0f0231
@@ -206,7 +206,8 @@ namespace {
0f0231
 
0f0231
 		void run() {
0f0231
 			auto line_length = 80;
0f0231
-			for (block_address b = 0; b < 2000; b++) {
0f0231
+			block_address nr_blocks = std::min<block_address>(2000, bm_.get_nr_blocks());
0f0231
+			for (block_address b = 0; b < nr_blocks; b++) {
0f0231
 				block_manager::read_ref rr = bm_.read_lock(b);
0f0231
 
0f0231
 				if (!(b % line_length)) {
0f0231
-- 
0f0231
1.8.3.1
0f0231