MDEV-4286 Server crashes in Protocol_text::store, stack smashing detected

AVG() returns a double, its max_length is reasonably
limited by a double number length, even if the argument
is many Kbytes long.
This commit is contained in:
Sergei Golubchik 2013-03-17 17:44:15 +01:00
commit 3827d70a0e
3 changed files with 18 additions and 2 deletions

View file

@ -1242,9 +1242,10 @@ void Item_sum_avg::fix_length_and_dec()
f_scale= args[0]->decimals;
dec_bin_size= my_decimal_get_binary_size(f_precision, f_scale);
}
else {
else
{
decimals= min(args[0]->decimals + prec_increment, NOT_FIXED_DEC);
max_length= args[0]->max_length + prec_increment;
max_length= min(args[0]->max_length + prec_increment, float_length(decimals));
}
}