BLI: Prevent Overflow in Grouped Number Output

Increase the buffer sizes used for `BLI_str_format_uint64_grouped` to
prevent overflow on strings representing numbers within the uint64
range. Also creates and uses defines for all the formatted string
buffer sizes.

Pull Request #105263
This commit is contained in:
2023-03-02 17:38:36 +01:00
parent ff6ce25926
commit 8c29d84139
12 changed files with 92 additions and 44 deletions

View File

@@ -143,7 +143,7 @@ void GeometryDataSetTreeViewItem::build_row(uiLayout &row)
if (const std::optional<int> count = this->count()) {
/* Using the tree row button instead of a separate right aligned button gives padding
* to the right side of the number, which it didn't have with the button. */
char element_count[7];
char element_count[BLI_STR_FORMAT_INT32_DECIMAL_UNIT_SIZE];
BLI_str_format_decimal_unit(element_count, *count);
UI_but_hint_drawstr_set((uiBut *)this->view_item_button(), element_count);
}