fix: stale slot indices, cascade OOB, pending over-alloc, collect_dependents bounds, size_t format on Windows

- stk_poll: unify load loops to always append on compacted array, removing stale pre-compaction slot indices
- stk_poll: heap-allocate cascade_indices per iteration, removing fixed 256-slot stack bound
- stk_pending_retry: shrink module array to actual count after retry loop completes
- stk_collect_dependents: add capacity parameter and bounds guard before index write
- stk_log_modules: cast module_count to unsigned long for C89 portable %lu on Windows
This commit is contained in:
anth64 committed 2026-03-08 10:12:51 +01:00
1 parent 0ebeafd4bb
commit 0cd50a5781
4 files changed
+45 -52

No files matched your search

+6 -1
View File
@@ -747,7 +747,7 @@ cleanup:
free(result);
}
void stk_collect_dependents(size_t *indices, size_t *count)
void stk_collect_dependents(size_t *indices, size_t *count, size_t capacity)
{
size_t i, d;
int in_set, changed;
@@ -778,6 +778,8 @@ void stk_collect_dependents(size_t *indices, size_t *count)
for (k = 0; k < *count; k++) {
if (indices[k] ==
(size_t)dep_index) {
if (*count >= capacity)
goto next_module;
indices[(*count)++] = i;
changed = 1;
goto next_module;
@@ -1093,6 +1095,9 @@ size_t stk_pending_retry(void)
if (stk_pending_count == 0)
stk_pending_free();
if (loaded > 0)
stk_module_realloc_memory(module_count);
return loaded;
}