1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-35721 UBSAN: runtime error: -nan outside range

Prevent division by zero when reading table statistics
This commit is contained in:
Dave Gosselin
2025-02-04 13:42:18 -05:00
committed by Daniel Black
parent 669f719cc2
commit 00fa5b8676
3 changed files with 44 additions and 1 deletions

View File

@@ -3139,7 +3139,7 @@ read_statistics_for_table(THD *thd, TABLE *table,
double avg_frequency= pk_read_stats->get_avg_frequency(j-1);
set_if_smaller(avg_frequency, 1);
double val= (pk_read_stats->get_avg_frequency(j) /
avg_frequency);
avg_frequency > 0 ? avg_frequency : 1);
index_statistics->set_avg_frequency (l, val);
}
}