From bd5b98cb46226f4bdb6ef19bf55ea95b3cfe7a42 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 1 Jul 2025 21:34:30 -0600 Subject: [PATCH] Ensure algorithmic safety (potentially KICAD-9RN). (cherry picked from commit 39f6b30ee76e8cc4b09314cb6fc6819fc4c8585b) --- pcbnew/drc/drc_cache_generator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pcbnew/drc/drc_cache_generator.cpp b/pcbnew/drc/drc_cache_generator.cpp index 89bc15de63..ac77ac091f 100644 --- a/pcbnew/drc/drc_cache_generator.cpp +++ b/pcbnew/drc/drc_cache_generator.cpp @@ -51,6 +51,10 @@ bool DRC_CACHE_GENERATOR::Run() if( m_drcEngine->QueryWorstConstraint( PHYSICAL_HOLE_CLEARANCE_CONSTRAINT, worstConstraint ) ) largestPhysicalClearance = std::max( largestPhysicalClearance, worstConstraint.GetValue().Min() ); + // Ensure algorithmic safety + largestClearance = std::min( largestClearance, INT_MAX / 3 ); + largestPhysicalClearance = std::min( largestPhysicalClearance, INT_MAX / 3 ); + std::set allZones; for( ZONE* zone : m_board->Zones() )