From 956875e2f45659b0b422dd369a3375d580c0a2e8 Mon Sep 17 00:00:00 2001
From: Jeff Young <jeff@rokeby.ie>
Date: Wed, 26 Feb 2025 12:49:51 +0000
Subject: [PATCH] DRC_LAST is the last index, not the size.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20049
---
 pcbnew/dialogs/dialog_drc.cpp | 2 +-
 pcbnew/drc/drc_engine.cpp     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp
index 09985c7746..07b2c437ea 100644
--- a/pcbnew/dialogs/dialog_drc.cpp
+++ b/pcbnew/dialogs/dialog_drc.cpp
@@ -1329,7 +1329,7 @@ void DIALOG_DRC::updateDisplayedCounts()
     bool unconnectedOverflowed = false;
     bool footprintsOverflowed = false;
 
-    for( int ii = DRCE_FIRST; ii < DRCE_LAST; ++ii )
+    for( int ii = DRCE_FIRST; ii <= DRCE_LAST; ++ii )
     {
         const SEVERITY severity = bds().GetSeverity( ii );
 
diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp
index 5030d9a79b..d6af174d09 100644
--- a/pcbnew/drc/drc_engine.cpp
+++ b/pcbnew/drc/drc_engine.cpp
@@ -595,7 +595,7 @@ void DRC_ENGINE::InitEngine( const wxFileName& aRulePath )
         throw original_parse_error;
     }
 
-    for( int ii = DRCE_FIRST; ii < DRCE_LAST; ++ii )
+    for( int ii = DRCE_FIRST; ii <= DRCE_LAST; ++ii )
         m_errorLimits[ ii ] = ERROR_LIMIT;
 
     m_rulesValid = true;
@@ -612,7 +612,7 @@ void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aT
     m_reportAllTrackErrors = aReportAllTrackErrors;
     m_testFootprints = aTestFootprints;
 
-    for( int ii = DRCE_FIRST; ii < DRCE_LAST; ++ii )
+    for( int ii = DRCE_FIRST; ii <= DRCE_LAST; ++ii )
     {
         if( m_designSettings->Ignore( ii ) )
             m_errorLimits[ ii ] = 0;