Skip to content

Commit c3f9ddf

Browse files
committed
MDEV-28374 UBSAN signed integer overflow PROCEDURE ANALYSE (fix)
The test cases added in [1] had a > 64 character recommendation for Optimal_fieldtype. This was the limit on output of the field. Under cursor mode the limit was enforced truncating the output. Raised to a 1024 character limits as a fix for the MDEV-28374 tests, which exceeds the amount needed for for the utility of users. Note currently the output_str_length used in analyse::change_columns is not currently set (so is 0) until analyse::end_of_records is called, which is later. Consequently output_str_length is 0 and the 1024 raised maximium is used. MDEV-39586 has been raised to correct this. [1] 6eda0af
1 parent da950e1 commit c3f9ddf

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

sql/sql_analyse.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,8 +1196,12 @@ bool analyse::change_columns(THD *thd, List<Item> &field_list)
11961196
func_items[7]= new (mem_root) Item_proc_string(thd, "Avg_value_or_avg_length", 255);
11971197
func_items[8]= new (mem_root) Item_proc_string(thd, "Std", 255);
11981198
func_items[8]->set_maybe_null();
1199+
/*
1200+
* TODO MDEV-39586 need to set output_str_length for cursor retrieval
1201+
* earlier because currently its always 0.
1202+
*/
11991203
func_items[9]= new (mem_root) Item_proc_string(thd, "Optimal_fieldtype",
1200-
MY_MAX(64,
1204+
MY_MAX(1024,
12011205
output_str_length));
12021206

12031207
for (uint i = 0; i < array_elements(func_items); i++)

0 commit comments

Comments
 (0)