Skip to content

Commit 2f67801

Browse files
Tor Didriksenzmur
authored andcommitted
Bug#36563773 MYSQL SERVER 8.3.0 GLOBAL-BUFFER-OVERFLOW AT 'DECIMAL_BIN_SIZE_INLINE'
Limit the scale used when computing averages of decimal numbers. Simplified patch backported. Change-Id: If32143ad7ed55f841e3973e78fa8e98cc245e775
1 parent 3bb3785 commit 2f67801

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sql/item_sum.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
1+
/* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License, version 2.0,
@@ -1728,7 +1728,7 @@ void Item_sum_avg::fix_length_and_dec()
17281728
decimals,
17291729
unsigned_flag);
17301730
f_precision= min(precision+DECIMAL_LONGLONG_DIGITS, DECIMAL_MAX_PRECISION);
1731-
f_scale= args[0]->decimals;
1731+
f_scale = min<uint>(args[0]->decimals, f_precision);
17321732
dec_bin_size= my_decimal_get_binary_size(f_precision, f_scale);
17331733
}
17341734
else {

0 commit comments

Comments
 (0)