• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

davidbyttow / govips
72%
master: 39%

Build:
Build:
LAST BUILD BRANCH: fix/startup-error-handling
DEFAULT BRANCH: master
Repo Added 04 Jan 2017 04:44AM UTC
Files 19
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH fix/keepalive-cgo
branch: fix/keepalive-cgo
CHANGE BRANCH
x
Reset
  • fix/keepalive-cgo
  • 0.4.4
  • c_format
  • david/fix-tests
  • david/minor-cleanups
  • david/revert-obsoletion
  • davidbyttow/fix-gnu-warnings
  • dependabot/go_modules/golang.org/x/image-0.10.0
  • dependabot/go_modules/golang.org/x/image-0.18.0
  • dependabot/go_modules/golang.org/x/image-0.5.0
  • dependabot/go_modules/golang.org/x/net-0.17.0
  • dependabot/go_modules/golang.org/x/net-0.23.0
  • dependabot/go_modules/golang.org/x/net-0.7.0
  • dependabot/npm_and_yarn/examples/tiff/minimist-1.2.6
  • dependabot/npm_and_yarn/examples/tiff/semver-7.5.3
  • dependabot/npm_and_yarn/examples/tiff/semver-7.5.4
  • dependabot/npm_and_yarn/examples/tiff/sharp-0.30.5
  • dependabot/npm_and_yarn/examples/tiff/sharp-0.32.6
  • dependabot/npm_and_yarn/examples/tiff/simple-get-4.0.1
  • devops-update
  • devops-update2
  • export_params
  • export_tiff
  • fix-#144
  • fix/247-test-reorg
  • fix/275-cmyk-icc-profile
  • fix/287-grey-gradient
  • fix/306-transparent-canvas
  • fix/350-animated-resize-rounding
  • fix/359-gif-quality-docs
  • fix/381-loop-metadata
  • fix/457-jxl-detection
  • fix/463-tiff-tile-zero
  • fix/489-480-image-interop
  • fix/c-code-bugs
  • fix/ci-go-version
  • fix/memory-leaks
  • fix/minor-cleanup
  • fix/quick-wins
  • fix/readme-deprecated-api
  • fix/remove-incorrect-defers
  • fix/replace-deprecated-getpageheight
  • fix/startup-error-handling
  • fix/test-panics-to-fatal
  • fix_21
  • fix_embed_alpha
  • gobject_save
  • goldentests
  • images
  • import_params
  • importparams
  • jake/webp-shrink-on-load
  • jammy-ref
  • logging
  • mac_version
  • master
  • merge-files
  • newgoldens
  • reduce-handwritten-c-bridge-code
  • refresh
  • refs/tags/2.10.0
  • refs/tags/v2.1.0
  • refs/tags/v2.10.0
  • refs/tags/v2.11.0
  • refs/tags/v2.12.0
  • refs/tags/v2.13.0
  • refs/tags/v2.14.0
  • refs/tags/v2.15.0
  • refs/tags/v2.17.0
  • refs/tags/v2.2.0
  • refs/tags/v2.3.0
  • refs/tags/v2.3.1
  • refs/tags/v2.4.0
  • refs/tags/v2.5.0
  • refs/tags/v2.6.0
  • refs/tags/v2.7.0
  • refs/tags/v2.8.0
  • refs/tags/v2.8.1
  • refs/tags/v2.9.0
  • revert-merge
  • test/tier1-coverage
  • toni-test
  • toni-testing
  • tonimelisma-doubleunref
  • tonimelisma-patch-1
  • update
  • v2.0.0
  • v2.0.1
  • v2.0.2
  • vipsgen
  • worktree-fix-avis-detection

27 Feb 2026 09:51PM UTC coverage: 71.754% (+0.01%) from 71.743%
22505189670

Pull #494

github

davidbyttow
Add runtime.KeepAlive to prevent GC finalization during CGo calls

ImageRef methods that pass r.image to CGo functions without
referencing r afterward are vulnerable to a use-after-free: the GC
can finalize the ImageRef (via runtime.SetFinalizer) while the CGo
call is still executing on the underlying C.VipsImage pointer.

This manifests as flaky segfaults, e.g. TestImageRef_FindTrim_White
crashing with "instance of invalid non-instantiatable type" from GLib.

Fix: add defer runtime.KeepAlive(r) to all 33 vulnerable methods,
ensuring the receiver stays alive for the duration of each CGo call.
This is the standard Go idiom (used in os.File, net.Conn, etc.).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pull Request #494: Fix GC use-after-free in ImageRef CGo calls

24 of 33 new or added lines in 1 file covered. (72.73%)

2238 of 3119 relevant lines covered (71.75%)

0.76 hits per line

Relevant lines Covered
Build:
Build:
3119 RELEVANT LINES 2238 COVERED LINES
0.76 HITS PER LINE
Source Files on fix/keepalive-cgo
  • Tree
  • List 22
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
22505189670 fix/keepalive-cgo Add runtime.KeepAlive to prevent GC finalization during CGo calls ImageRef methods that pass r.image to CGo functions without referencing r afterward are vulnerable to a use-after-free: the GC can finalize the ImageRef (via runtime.SetFinalizer) ... Pull #494 27 Feb 2026 09:53PM UTC davidbyttow github
71.75
22505190686 fix/keepalive-cgo Add runtime.KeepAlive to prevent GC finalization during CGo calls ImageRef methods that pass r.image to CGo functions without referencing r afterward are vulnerable to a use-after-free: the GC can finalize the ImageRef (via runtime.SetFinalizer) ... Pull #494 27 Feb 2026 09:53PM UTC davidbyttow github
71.75
22504633026 fix/keepalive-cgo Add runtime.KeepAlive to prevent GC finalization during CGo calls ImageRef methods that pass r.image to CGo functions without referencing r afterward are vulnerable to a use-after-free: the GC can finalize the ImageRef (via runtime.SetFinalizer) ... Pull #494 27 Feb 2026 09:35PM UTC davidbyttow github
71.7
See All Builds (623)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc