Skip to content

gvc: replace disintegration/imaging with golang.org/x/image/draw - #130

Open
diillson wants to merge 1 commit into
goccy:masterfrom
diillson:drop-imaging
Open

diillson wants to merge 1 commit into
goccy:masterfrom
diillson:drop-imaging

Conversation

@diillson

@diillson diillson commented Nov 8, 2026

Copy link
Copy Markdown

Fixes #129.

github.com/disintegration/imaging v1.6.2 was required for one call, imaging.Resize in gvc/image_renderer.go. The module is unmaintained (last release 2019) and carries CVE-2023-36308 with no fixed version, so every binary importing go-graphviz gets flagged by Trivy, Grype and govulncheck.

This replaces that call with golang.org/x/image/draw (draw.CatmullRom.Scale), which is already a dependency through golang.org/x/image, and removes imaging from go.mod/go.sum.

  • resizeImage keeps imaging.Resize's semantics for a zero width or height: the missing side is derived from the aspect ratio, and both zero returns the image unchanged. Catmull-Rom is the highest-quality kernel in x/image/draw.
  • No public API changes, no new dependency.
  • Adds gvc/image_renderer_test.go covering the three size cases and the zero-size passthrough.

cmd/dot/go.mod is left untouched: it builds against the published go-graphviz version and will pick the change up on its next bump.

github.com/disintegration/imaging v1.6.2 was required for a single call,
imaging.Resize in gvc/image_renderer.go. The module is unmaintained (last
release in 2019) and carries CVE-2023-36308 with no fixed version, so every
binary that imports go-graphviz is flagged by Trivy, Grype and govulncheck.

Resize with draw.CatmullRom.Scale from golang.org/x/image/draw instead,
which is already a dependency through golang.org/x/image, and drop imaging
from go.mod. resizeImage keeps imaging.Resize's behaviour for a zero width
or height (the missing side follows the aspect ratio; both zero returns the
image unchanged). No public API changes, no new dependency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drop github.com/disintegration/imaging (unmaintained, CVE-2023-36308) in favour of golang.org/x/image/draw

1 participant