Skip to content

Add GitHub Actions CI and SECURITY.md - #6

Open
austek wants to merge 6 commits into
espeak-ng:masterfrom
ZirekHQ:ci/github-actions-security-md-espeak
Open

Add GitHub Actions CI and SECURITY.md#6
austek wants to merge 6 commits into
espeak-ng:masterfrom
ZirekHQ:ci/github-actions-security-md-espeak

Conversation

@austek

@austek austek commented Aug 23, 2026

Copy link
Copy Markdown

Summary

Adds a 4-job CI workflow (.github/workflows/ci.yml), ported from waywardgeek/sonic#67 and adapted/verified against this fork's actual build:

  • build-and-test: matrix across ubuntu-latest/macos-latest, make && make test.
  • strict-and-sanitized: make test with -Werror and ASan+UBSan (clang).
  • fuzz-smoke: 2-minute bounded run of the existing tests/fuzz_main.c harness via make fuzz, uploading crash-* artifacts on failure.
  • coverage: make coverage, uploading the resulting .gcov files.

Two drive-by fixes were needed for the sanitized job to be meaningfully green:

  • findSincCoefficient left-shifted a value that can be negative (sincTable has negative entries) — UB in C. Replaced with the behaviorally-identical *2.
  • tests/sonic_api_test.c had an unused-variable warning under -Wall.

Also fixes a stack-buffer-overflow in tests/fuzz_main.c's read loop: outBuffer was sized 1024 shorts but sonicReadShortFromStream's maxSamples is a per-channel count, so a fuzzer-generated numChannels=2 stream could ask the library to write up to 2048 shorts into it (confirmed via ASan). Fix caps the read request by dividing the buffer size by numChannels.

Extends .gitignore for the build artifacts these jobs produce, and adds SECURITY.md pointing reporters at GitHub's private security advisory flow.

Important: overlaps with #2

This fork's master doesn't yet have the root test/fuzz/coverage Makefile targets or tests/fuzz_main.c/tests/sonic_api_test.c — those exist here only via the 3 commits already staged in #2 ("Sync 5 commits from waywardgeek/sonic"). This branch includes those same 3 commits directly, so the CI setup is self-contained and its jobs actually run rather than immediately failing on missing targets. That means this PR's diff currently overlaps with #2's.

If #2 lands first, this branch can be rebased down to just the CI-specific diff — happy to do that once you've decided the order.

Test plan

All four jobs' exact commands verified locally on this branch:

  • make && make test — passes, no warnings
  • make CC=clang CFLAGS="-Wall -Werror -g -fsanitize=address,undefined -fno-omit-frame-pointer" test — passes clean
  • make fuzz + ./fuzz_sonic -max_total_time=120 — 669,653 runs, 0 crashes, exit 0
  • make coverage — 74.21% line coverage, .gcov generated

parallelcc and others added 6 commits August 27, 2025 02:54
Fix downSampleBuffer overflow when numChannels != 1
Allow gcc to be overridden by passed in CC
Change CC variable assignment to conditional
Adds a 4-job CI workflow (.github/workflows/ci.yml):
- build-and-test: matrix across ubuntu-latest/macos-latest, make && make test.
- strict-and-sanitized: make test with -Werror and ASan+UBSan (clang).
- fuzz-smoke: 2-minute bounded run of the existing tests/fuzz_main.c
  harness via make fuzz, uploading crash-* artifacts on failure.
- coverage: make coverage, uploading the resulting .gcov files.

Two drive-by fixes were needed to make the sanitized job meaningfully
green, both found while building this out:
- sonic.c's findSincCoefficient left-shifted a value that can be
  negative (sincTable has negative entries) -- undefined behavior in
  C. Replaced with the behaviorally-identical *2.
- tests/sonic_api_test.c had an unused-variable warning under -Wall.

Also fixes a stack-buffer-overflow in tests/fuzz_main.c's read loop:
outBuffer was sized 1024 shorts but sonicReadShortFromStream's
maxSamples argument is a per-channel count, so a fuzzer-generated
numChannels=2 stream could ask the library to write up to 2048 shorts
into it. Confirmed via ASan (stack-buffer-overflow, WRITE of size 2144
in sonicReadShortFromStream). This is a harness bug, not a sonic.c
bug -- fix caps the read request by dividing the buffer size by
numChannels.

Extends .gitignore to cover the build artifacts (test binaries,
.gcda/.gcno/.gcov, libsonic*) these CI jobs' make invocations produce.

Adds SECURITY.md pointing reporters at GitHub's private security
advisory flow, since there's no published security contact email.

Ported from waywardgeek/sonic#67, adapted for this fork's build:
verified all four jobs' exact commands here directly (make test,
make CC=clang CFLAGS="-Wall -Werror -g -fsanitize=address,undefined
-fno-omit-frame-pointer" test, make fuzz + a 2-minute run [669653
runs, 0 crashes], make coverage). The sonic_unit_test/coverage source
lists and tests/fuzz_main.c/tests/sonic_api_test.c this depends on
came from waywardgeek/sonic's "Basic unit tests and fuzzing" commit,
already staged for this repo in the separate, still-open PR espeak-ng#2
("Sync 5 commits from waywardgeek/sonic") -- this branch includes
those same prerequisite commits directly so the CI setup is
self-contained and doesn't depend on espeak-ng#2 merging first.
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.

4 participants