| 78 | } |
| 79 | |
| 80 | static bool bootstrap_worker_budget_valid(const char *text) { |
| 81 | if (!text || !text[0]) { |
| 82 | return false; |
| 83 | } |
| 84 | size_t value = 0; |
| 85 | for (const unsigned char *cursor = (const unsigned char *)text; *cursor; cursor++) { |
| 86 | if (*cursor < '0' || *cursor > '9') { |
| 87 | return false; |
| 88 | } |
| 89 | size_t digit = (size_t)(*cursor - '0'); |
| 90 | if (value > (SIZE_MAX - digit) / 10U) { |
| 91 | return false; |
| 92 | } |
| 93 | value = value * 10U + digit; |
| 94 | } |
| 95 | return value > 0; |
| 96 | } |
| 97 | |
| 98 | /* Keep the bootstrap role boundary exact and fail closed before any client or |
| 99 | * worker state is initialized. index_supervisor owns the matching builder and |
no outgoing calls
no test coverage detected