Skip to content

CI: add sanitizer build job (ASAN/UBSAN) - #131

Draft
mikeller wants to merge 2 commits into
subsurface:Subsurface-DS9from
mikeller:feat/ci-asan-#94
Draft

CI: add sanitizer build job (ASAN/UBSAN)#131
mikeller wants to merge 2 commits into
subsurface:Subsurface-DS9from
mikeller:feat/ci-asan-#94

Conversation

@mikeller

@mikeller mikeller commented Sep 8, 2026

Copy link
Copy Markdown
Member

Add a 'sanitizers' job that builds with -fsanitize=address,undefined
using clang on ubuntu-latest and runs make distcheck under the
sanitizer. ASAN_OPTIONS=detect_leaks=1 and abort_on_error=1 ensure any
detected leak or memory error fails the build immediately.

Full parser coverage under the sanitizer requires sample dump fixtures
and a parse harness to be wired into this job in a follow-up.

Copilot AI lite review requested due to automatic review settings September 8, 2026 23:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The sanitizer flags are not reliably propagated to the make distcheck rebuild, so the new job may not actually run the distcheck build under ASAN/UBSAN as intended.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a new GitHub Actions job intended to run the project’s build and make distcheck under AddressSanitizer/UndefinedBehaviorSanitizer to catch memory errors in CI.

Changes:

  • Add a new sanitizers job on ubuntu-latest using clang.
  • Configure ASAN/UBSAN runtime options and run make distcheck in CI.
File summaries
File Description
.github/workflows/build.yml Adds a new CI job to build and run distcheck under sanitizers.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/build.yml
Add a 'sanitizers' job that builds with -fsanitize=address,undefined
using clang on ubuntu-latest and runs make distcheck under the
sanitizer. ASAN_OPTIONS=detect_leaks=1 and abort_on_error=1 ensure any
detected leak or memory error fails the build immediately.

Full parser coverage under the sanitizer requires sample dump fixtures
and a parse harness to be wired into this job in a follow-up.

Signed-off-by: Michael Keller <github@ike.ch>
Copilot AI review requested due to automatic review settings September 9, 2026 02:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The sanitizer job is wired correctly so make distcheck inherits the sanitizer build flags and runtime options as intended.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Add raw per-dive binary dumps (captured via dctool download) for three
device families, together with a manifest and a shell harness that runs
dctool parse over each fixture and fails on any non-zero exit.

test/fixtures/manifest.txt
  Maps each blob to the exact dctool descriptor string used at capture
  and required at replay.  Format: filename|vendor|product.

test/fixtures/shearwater_petrel2-0001.bin  (21 KB)
  Shearwater Petrel 2, SHEARWATER_PETREL family, CCR dive, no GPS.
  Descriptor: 'Shearwater Petrel 2', transport: bluetooth (classic).

test/fixtures/hw_ostc5-0001.bin  (15 KB)
  Heinrichs Weikamp OSTC 5, HW_OSTC3 family, CCR dive, no GPS.
  Descriptor: 'Heinrichs Weikamp OSTC 5', transport: bluetooth (classic).

test/fixtures/garmin_descent_mk2i-0001.bin  (12 KB)
  Garmin Descent Mk2i, GARMIN family, no GPS.
  Descriptor: 'Garmin Descent Mk2(i)/Mk3(i)(S)/G1/G2/X50i',
  transport: USB storage (MTP).

All three families use dc_field_add_string / dc_field_cache, which is
the code path affected by the field-cache leak reported upstream.
Parsing all three fixtures under an ASAN build with detect_leaks=1
reproduces the leak without the fix applied; with the fix the run is
clean.

test/run-parse.sh
  Locates the built examples/dctool, reads the manifest, and runs
  'dctool -d "<descriptor>" parse -o /dev/null <blob>' for each entry.
  Exits non-zero if any invocation returns non-zero.  Under the
  sanitizer build the ASAN abort_on_error flag turns any detected
  error into a non-zero exit, so a leak or memory error surfaces as a
  failed parse step.

Wire the harness into the sanitizers CI job with:
  - run: test/run-parse.sh

No autotools make-check infrastructure is introduced; the script is a
standalone entry point deliberately kept small and reviewable.

Dive data is the device owner's own recordings, cleared for
redistribution under the library licence.  No GPS or personal location
data is present in any of the committed blobs.

Signed-off-by: Michael Keller <github@ike.ch>
Copilot AI review requested due to automatic review settings September 9, 2026 15:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The sanitizer job wiring and the new fixture parse harness align with existing dctool descriptor selection behavior and don’t introduce any verified functional issues.

Review details
  • Files reviewed: 3/6 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

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.

2 participants