| 90 | } |
| 91 | |
| 92 | static bool bootstrap_worker_budget_valid(const char *text) { |
| 93 | if (!text || !text[0]) { |
| 94 | return false; |
| 95 | } |
| 96 | size_t value = 0; |
| 97 | for (const unsigned char *cursor = (const unsigned char *)text; *cursor; cursor++) { |
| 98 | if (*cursor < '0' || *cursor > '9') { |
| 99 | return false; |
| 100 | } |
| 101 | size_t digit = (size_t)(*cursor - '0'); |
| 102 | if (value > (SIZE_MAX - digit) / 10U) { |
| 103 | return false; |
| 104 | } |
| 105 | value = value * 10U + digit; |
| 106 | } |
| 107 | return value > 0; |
| 108 | } |
| 109 | |
| 110 | /* Keep the bootstrap role boundary exact and fail closed before any client or |
| 111 | * worker state is initialized. index_supervisor owns the matching builder and |
no outgoing calls
no test coverage detected