fix(testsuite): resize crr_build_config caller arrays -- bug-1977

The external-license-resources E2 fixture builder crr_build_config
registers five resources and four distributions, writing resources[4],
dists[3] and vals[4]. All four caller test functions declared only
resources[4]/dists[3]/vals[4], so every build_config call wrote past
the caller's stack arrays -- deterministic ASAN stack-buffer-overflow,
the whole controller suite (137 fixtures) red since 2fcacac2.

Resize the four caller arrays to match the builder's sizing
(resources[5]/dists[4]/vals[5]) with a bug-1977 comment on the sizing
contract. No production code touched.

Verified: src/tools/xce-build.sh controller (asan) 6/6 OK, controller
suite 91s green; buglog record .wolf/bugs/bug-1977.md.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
lei.chen 2026-10-28 11:58:09 +00:00
parent 30c51ea147
commit b38ef6de63
3 changed files with 131 additions and 12 deletions

View file

@ -142,9 +142,13 @@ static void test_reconcile_resources_registers_and_seeds_shared_pools(void)
cluster_t c;
myconf_t conf;
cluster_config_t cfg;
xce_resource_t* resources[4];
res_distribution_t* dists[3];
xce_val_t* vals[4];
/* bug-1977: the builder registers FIVE resources (indices 0..4) and
* FOUR distributions (indices 0..3) -- the caller arrays must match,
* or the builder's resources[4]/dists[3]/vals[4] writes overflow these
* stacks (ASAN stack-buffer-overflow, deterministic). */
xce_resource_t* resources[5];
res_distribution_t* dists[4];
xce_val_t* vals[5];
xce_resource_t* r;
if (makeString((char*)"crr-probe") == NULL)
@ -230,9 +234,11 @@ static void test_reconcile_resources_registers_new_defs_past_eexist(void)
cluster_t c;
myconf_t conf;
cluster_config_t cfg;
xce_resource_t* resources[4];
res_distribution_t* dists[3];
xce_val_t* vals[4];
/* bug-1977: the builder writes resources[0..4]/dists[0..3]/vals[0..4] --
* caller arrays must match its sizing. */
xce_resource_t* resources[5];
res_distribution_t* dists[4];
xce_val_t* vals[5];
xce_resource_t* r;
xce_val_t* v;
@ -304,9 +310,11 @@ static void test_reconcile_resources_hot_applies_changed_definition(void)
cluster_t c;
myconf_t conf;
cluster_config_t cfg;
xce_resource_t* resources[4];
res_distribution_t* dists[3];
xce_val_t* vals[4];
/* bug-1977: the builder writes resources[0..4]/dists[0..3]/vals[0..4] --
* caller arrays must match its sizing. */
xce_resource_t* resources[5];
res_distribution_t* dists[4];
xce_val_t* vals[5];
xce_resource_t* r;
static xce_resource_t old_extlic;
@ -363,9 +371,11 @@ static void test_reconcile_resources_is_idempotent_and_hot_applies(void)
cluster_t c;
myconf_t conf;
cluster_config_t cfg;
xce_resource_t* resources[4];
res_distribution_t* dists[3];
xce_val_t* vals[4];
/* bug-1977: the builder writes resources[0..4]/dists[0..3]/vals[0..4] --
* caller arrays must match its sizing. */
xce_resource_t* resources[5];
res_distribution_t* dists[4];
xce_val_t* vals[5];
xce_resource_t* r;
xce_val_t* v;