summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-10-25 17:17:21 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-10-25 17:17:21 +0300
commitcbd0da66e48a2ea31917dae0b49a4ca6092959e7 (patch)
tree9efc2c0f3e1c0cd367255fce203c15190d13888f /sql/sql_select.cc
parenta02551b0ba220cb138cf3e9cddd82539620c6432 (diff)
parent909cdafd35c05b56e47d2c791149a5dd85621870 (diff)
downloadmariadb-git-cbd0da66e48a2ea31917dae0b49a4ca6092959e7.tar.gz
Merge 10.1 into 10.2
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 46e1a912250..5075673dcc2 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8125,9 +8125,11 @@ best_extension_by_limited_search(JOIN *join,
best_access_path(join, s, remaining_tables, idx, disable_jbuf,
record_count, join->positions + idx, &loose_scan_pos);
- /* Compute the cost of extending the plan with 's' */
-
- current_record_count= record_count * position->records_read;
+ /* Compute the cost of extending the plan with 's', avoid overflow */
+ if (position->records_read < DBL_MAX / record_count)
+ current_record_count= record_count * position->records_read;
+ else
+ current_record_count= DBL_MAX;
current_read_time=read_time + position->read_time +
current_record_count / (double) TIME_FOR_COMPARE;