summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorSunny Bains <Sunny.Bains@Oracle.Com>2010-08-16 11:59:43 +1000
committerSunny Bains <Sunny.Bains@Oracle.Com>2010-08-16 11:59:43 +1000
commitadde4bac9867c279a8974ef08ea42afd74e5e4f4 (patch)
treea09e98b7138bb400c32a7e3249979d5cd6fda460 /storage/innobase
parenteebecee7d3559281e30c13027f77782aec131f29 (diff)
downloadmariadb-git-adde4bac9867c279a8974ef08ea42afd74e5e4f4.tar.gz
Fix Bug #55277 - Failing assertion: auto_inc > 0
Handle overflow when reading value from SELECT MAX(C) FROM T; Call ha_innobase::info() after initializing the autoinc value in ha_innobase::open(). Fix for both the builtin and plugin. rb://402 Merge from mysql-5.1-security.
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/handler/ha_innodb.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index ab9df9a0272..e1b9f9e224f 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -3528,12 +3528,19 @@ ha_innobase::innobase_initialize_autoinc()
err = row_search_max_autoinc(index, col_name, &read_auto_inc);
switch (err) {
- case DB_SUCCESS:
+ case DB_SUCCESS: {
+ ulonglong col_max_value;
+
+ col_max_value = innobase_get_int_col_max_value(field);
+
/* At the this stage we do not know the increment
- or the offset, so use a default increment of 1. */
- auto_inc = read_auto_inc + 1;
- break;
+ nor the offset, so use a default increment of 1. */
+
+ auto_inc = innobase_next_autoinc(
+ read_auto_inc, 1, 1, col_max_value);
+ break;
+ }
case DB_RECORD_NOT_FOUND:
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: MySQL and InnoDB data "
@@ -3828,8 +3835,6 @@ retry:
dict_table_get_format(prebuilt->table));
}
- info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
-
/* Only if the table has an AUTOINC column. */
if (prebuilt->table != NULL && table->found_next_number_field != NULL) {
dict_table_autoinc_lock(prebuilt->table);
@@ -3846,6 +3851,8 @@ retry:
dict_table_autoinc_unlock(prebuilt->table);
}
+ info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
+
DBUG_RETURN(0);
}