← Back to team overview

kicad-developers team mailing list archive

[PATCH] Avoid an infinite loop in PNS

 

Hi All,

Following bug 1702485, please find attached a patch to fix this infinite
loop.

Bug report containt all detail how to reproduce...


>From cbffb761a9b25307084aec5504dfbd5afeb67ffc Mon Sep 17 00:00:00 2001
From: Jean-Samuel Reynaud <js.reynaud@xxxxxxxxx>
Date: Thu, 6 Jul 2017 10:40:52 +0200
Subject: [PATCH] Avoid an infinite loop in PNS
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.7.4"

This is a multi-part message in MIME format.
--------------2.7.4
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


Fixes: lp:1702485
* https://bugs.launchpad.net/kicad/+bug/1702485
---
 pcbnew/router/pns_diff_pair.cpp | 4 ++++
 1 file changed, 4 insertions(+)


--------------2.7.4
Content-Type: text/x-patch; name="0001-Avoid-an-infinite-loop-in-PNS.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Avoid-an-infinite-loop-in-PNS.patch"

diff --git a/pcbnew/router/pns_diff_pair.cpp b/pcbnew/router/pns_diff_pair.cpp
index 0279e1b..6088907 100644
--- a/pcbnew/router/pns_diff_pair.cpp
+++ b/pcbnew/router/pns_diff_pair.cpp
@@ -410,6 +410,10 @@ static VECTOR2I makeGapVector( VECTOR2I dir, int length )
 {
     int l = length / 2;
     VECTOR2I rv;
+
+    if( dir.EuclideanNorm() == 0 )
+        return dir;
+
     do
 	{
         rv = dir.Resize( l );

--------------2.7.4--



Follow ups