From 5605aa061520d4ca1caa1dcfca357e333cb5899e Mon Sep 17 00:00:00 2001 From: Ilya Date: Thu, 23 Mar 2017 16:58:18 +0300 Subject: [PATCH] I used PVS-Studio static analyzer to check this project. I would like to suggest a variant of the way to fix the error, detected with the help of V534 diagnostic. Description of the diagnostic: https://www.viva64.com/en/examples/v534/ (dotnet/coreclr#10414) Incorrect variable 'i' from the outer loop is used in condition of the inner loop. Commit migrated from https://github.com/dotnet/coreclr/commit/5bcd08108f522524741805d97989e5f227a6bd6b --- src/coreclr/src/tools/metainfo/mdinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/src/tools/metainfo/mdinfo.cpp b/src/coreclr/src/tools/metainfo/mdinfo.cpp index 1432201..753321f 100644 --- a/src/coreclr/src/tools/metainfo/mdinfo.cpp +++ b/src/coreclr/src/tools/metainfo/mdinfo.cpp @@ -1418,7 +1418,7 @@ void MDInfo::DisplayFields(mdTypeDef inTypeDef, COR_FIELD_OFFSET *rFieldOffset, if (cFieldOffset) { bool found = false; - for (ULONG iLayout = 0; i < cFieldOffset; ++iLayout) + for (ULONG iLayout = 0; iLayout < cFieldOffset; ++iLayout) { if (RidFromToken(rFieldOffset[iLayout].ridOfField) == RidFromToken(fields[i])) { -- 2.7.4