gEDA-dev: Checking for zero boxes count in ComputeUnionArea

Andreas Kemnade andreas at kemnade.info
Thu Oct 26 04:04:57 EDT 2006


Hi,

this patch adds a check for zero boxes count in ComputeUnionArea,
so pcb does not segfault when it reaches the line
lastX = rectLeft[0]->X1

If you want to see the crash, just download

http://matrix.wearlab.de/~andi/pwrline.pcb
and
http://matrix.wearlab.de/~andi/pwrline.net

Load the circuit and the netlist, and then try to auto-place the elements.

Greetings
Andreas Kemnade

Index: src/intersect.c
===================================================================
RCS file: /cvsroot/pcb/pcb/src/intersect.c,v
retrieving revision 1.10
diff -u -r1.10 intersect.c
--- src/intersect.c	28 Mar 2006 04:29:19 -0000	1.10
+++ src/intersect.c	26 Oct 2006 07:56:50 -0000
@@ -226,6 +226,8 @@
   SegmentTree segtree;
   LocationType lastX;
   double area = 0.0;
+  if (boxlist->BoxN == 0)
+      return 0.0;
   /* create sorted list of Y coordinates */
   yCoords = createSortedYList (boxlist);
   /* now create empty segment tree */


More information about the geda-dev mailing list