Menu

#187 Crash on complex aperture macro

v1.0 (example)
open
nobody
None
5
2018-03-09
2014-07-19
No

gerbv 2.6.1 on Windows crashes when loading the complex aperture macro in the attached file crash-macro.gtl.

1 Attachments

Discussion

  • Dan Sheadel

    Dan Sheadel - 2018-03-09

    Additional details regarding this bug:
    Gerbv 2.6.1 and older simply crash, and refuses to open the file.
    Gerbv 2.6.2 instead opens the file, and generates a warning. However, the polygon is rendered incorrectly, and potentially may cause file corruption. Did not fully test this.

    This is very common from EasyPC and #1 Systems based tools, such as Diptrace and DesignSpark. When a custom pad shape is generated (such as rounded-rectangles), it's generated as a polygon macro. However, the tool generates the arcs using a large amount of small lines. This results in GerbV being often unusable for these design tools. The attached example is a simplified case of this error coming from DesignSpark.

    Fixing this bug is also remarkably simple, as it's caused solely by the APERTURE_PARAMETERS_MAX variable being set lower than the typical number of parameters used in scenarios like this. Commonly, these custom pads contain around 200 points per polygon, although larger polygons do occur in the wild. A good example is custom pads that represent a logo or drawing, which may have several hundred points.

     
  • Dan Sheadel

    Dan Sheadel - 2018-03-09

    The following patch resolves this issue by simply setting the maximum value arbitrarily high at 500 points, which should resolve all common cases of this bug, and most uncommon ones.

    As far as I can tell, the macro polygon system uses a malloc based on the number of points indicated by the polygon definition, so an arbitrarily large maximum should not result in any serious slowdowns or out-of-memory conditions when using large numbers of macros or polygons.

     

Log in to post a comment.