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

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