Skip to content

Commit e777d6f

Browse files
rocketmarkclaude
andcommitted
restore MAX_DRIVERS bump to 128 (regression from test-cleanup revert)
REGISTER_LINKTIME shares the Drivers[]/DriverNames[] arrays between real drivers/posers and every TEST() in src/test_cases/. With MAX_DRIVERS at 32, residual_cascade_props.c's 33 TEST() entries overflow the static arrays and segfault on startup. This fix previously existed in 916e844 but was lost across two reverts (322d129, 551cf9d) that were undoing unrelated changes bundled in the same commits. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 551cf9d commit e777d6f

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/survive_driverman.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ static const char *DriverNames[MAX_DRIVERS];
2020
static int NrDrivers;
2121

2222
void RegisterDriver(const char *element, survive_driver_fn data) {
23+
if (NrDrivers >= MAX_DRIVERS) {
24+
fprintf(stderr, "FATAL: RegisterDriver(\"%s\") exceeds MAX_DRIVERS (%d); raise MAX_DRIVERS in survive_internal.h\n",
25+
element, MAX_DRIVERS);
26+
abort();
27+
}
2328
Drivers[NrDrivers] = data;
2429
DriverNames[NrDrivers] = element;
2530
NrDrivers++;

src/survive_internal.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111

1212

1313
//Driver registration
14-
#define MAX_DRIVERS 32
14+
//
15+
// Every TEST() in src/test_cases/ also registers through this mechanism
16+
// (REGISTER_LINKTIME), so the cap must cover real drivers/posers plus the
17+
// largest test file's TEST() count. residual_cascade_props.c alone has 33.
18+
#define MAX_DRIVERS 128
1519

1620
SURVIVE_EXPORT const char *survive_config_file_name(struct SurviveContext *ctx);
1721
SURVIVE_EXPORT const char *survive_config_file_path(struct SurviveContext *ctx, char *path);

0 commit comments

Comments
 (0)