mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-11-03 00:13:42 +00:00
Fix bugs found by clang-tidy triage; ratchet warning budget to zero (#3047)
Real bugs fixed: - manager.c: kill_server/stop_server checked fscanf() != EOF, so malformed pid file content left pid uninitialized and passed it to kill(). Parse with fgets + ss_parse_int and require pid > 0. - utils.c: get_default_conf() crashed on strlen(NULL) when HOME is unset (e.g. daemons started by init) and left a dangling static pointer after free(), a latent use-after-free on repeated calls. Use a static buffer and fall back to the system config when HOME is missing. - local.c: in UDP_ONLY mode, start_ss_local_server() passed uninitialized listen_ctx.fd to the library callback. Initialize it to -1. Improvements: - Replace rand()/srand(time(NULL)) upstream-server selection in ss-local, ss-redir and ss-tunnel with libsodium randombytes_uniform(): unbiased, unpredictable, and no seeding required (cert-msc30/msc32). - Mark FATAL() noreturn so both the compiler and analyzers understand control flow (removes a family of analyzer false positives). - Drop two dead stores (manager.c restore_sigchld, udprelay.c src_addr_len). All remaining findings were verified as false positives and carry NOLINT comments with rationale (uthash macro internals, symmetric back-pointer cleanup, analyzer-invisible postconditions). clang-tidy-18 on Linux now reports zero warnings, so MAX_WARNINGS drops from 29 to 0. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -83,11 +83,12 @@ jobs:
|
||||
clang-tidy:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# Ratchet: number of pre-existing clang-tidy warnings (see .clang-tidy),
|
||||
# Ratchet: number of known clang-tidy warnings (see .clang-tidy),
|
||||
# counted with clang-tidy-18 (pinned below so runner upgrades don't move
|
||||
# the number). CI fails if the count goes UP; lower this value as
|
||||
# findings get fixed.
|
||||
MAX_WARNINGS: 29
|
||||
# the number). All baseline findings have been fixed or triaged
|
||||
# (false positives carry NOLINT comments with rationale), so any new
|
||||
# warning fails CI.
|
||||
MAX_WARNINGS: 0
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
|
||||
Reference in New Issue
Block a user