The E_XCE_* enum (errnox.h) gained NOMASTER/REDIRECT/NOT_READY/STANDBY (10011-10014) but xce_err_str[] still had only 10 strings + NULL, while the bounds check used E_XCE_MAX. Formatting any of those codes ran off the array: NOMASTER -> strncpy(NULL) deref; NOT_READY (10013, returned by ctrlstatus on a failover-exhausted cluster) -> read 8 bytes past the 88-byte table = the ASAN global-buffer-overflow at utils.c:335. Fix: fill the table for all 14 codes; bound xce_strerror_r against the actual array size + NULL (degrade to 'unknown error', never OOB); add a _Static_assert tying the table length to E_XCE_MAX so any future enum drift fails the build. Pre-existing foundation bug surfaced (not caused) by controller-status 6.4. RED: test_strerror_all_xce_codes SEGV'd at utils.c:335 under ASAN; GREEN: lib suite Ok:1 Fail:0. New tests in test_error.c cover all in-range + out-of-range codes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| autoscaler | ||
| controller | ||
| docs | ||
| frontend | ||
| include | ||
| lib | ||
| nixSupport | ||
| scheduler | ||
| schema | ||
| tools | ||
| worker | ||
| build | ||
| flake.lock | ||
| flake.nix | ||
| meson.build | ||
| meson.options | ||