Skip to content

Mis-rendering and confusing error message in aperture macro outline primitives with mismatched vertex count #171

@jaseg

Description

@jaseg

When presented with the following Gerber file, gerbv produces a corrupted rendering result and outputs a misleading error message.

test.txt

The file contains two aperture macro definitions. Both use an "outline" primitive. For some reason, in aperture macro outlines, the number of coordinate pairs is listed as a parameter. gerbv internally uses this parameter to allocate memory. When the parameter is mismatched to the actual number of vertices, it produces a cryptic error message on the command line:

Number of parameters to aperture macro (75) capped to stack capacity (54)

and produces a corrupted rendering result:

Screenshot from 2023-04-29 12-19-38

I reproduced this behavior on both gerbv 2.9.5 and 2.9.7-rc1.

Suggested resolution

  1. Detect the mismatch and warn the user with a sepecific warning message such as "Aperture macro outline vertex count does not match parameter count
  2. Either:
    a) Use the actual number of parameters instead of the stated vertex count to allocate memory, and render the outline as if the correct count was given (likely to be closest to user intent, and least likely to cause significant mismatch to user intent)
    b) Continue using the stated vertex count to allocate memory, and do not render anything at all when a mismatch is detected (smallest code change, but likely to cause significant mismatch to user intent).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions