Esme Povirk (@madewokherd) commented about dlls/uiautomationcore/uia_client.c:
+ SIZE_T new_capacity, max_capacity; + void *new_elements; + + if (element_count <= *capacity) + return TRUE; + + max_capacity = ~(SIZE_T)0 / element_size; + if (max_capacity < element_count) + return FALSE; + + new_capacity = max(*capacity, 4); + while (new_capacity < element_count && new_capacity <= max_capacity / 2) + new_capacity *= 2; + + if (new_capacity < element_count) + new_capacity = max_capacity; I'm not sure I fully understand this bit. I feel like the end result (assuming you're not starting from 0) is going to be `new_capacity = *capacity * 2`, or just `new_capacity = element_count` if that's too small. But maybe I'm missing something.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/1249#note_14107