MDEV-28490 Strange result truncation with group_concat_max_len=1GB.

Arythmetic can overrun the uint type when possible group_concat_max_len
is multiplied to collation.mbmaxlen (can easily be like 4).
So use ulonglong there for calculations.
This commit is contained in:
Alexey Botchkov 2022-05-15 23:28:06 +04:00
commit b03ab1270d
3 changed files with 88 additions and 3 deletions

View file

@ -4242,9 +4242,9 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
result.set_charset(collation.collation);
result_field= 0;
null_value= 1;
max_length= (uint32)MY_MIN(thd->variables.group_concat_max_len
/ collation.collation->mbminlen
* collation.collation->mbmaxlen, UINT_MAX32);
max_length= (uint32) MY_MIN((ulonglong) thd->variables.group_concat_max_len
/ collation.collation->mbminlen
* collation.collation->mbmaxlen, UINT_MAX32);
uint32 offset;
if (separator->needs_conversion(separator->length(), separator->charset(),