diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-04-27 08:08:06 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-04-27 08:08:06 +0300 |
commit | 44a27a26e910c9fb27731bd2cb267262949ea2da (patch) | |
tree | 196e64e99f192469aef887b0856795755a88db40 /storage | |
parent | f21a87560091a8149752b13e097d382ba30786d2 (diff) | |
download | mariadb-git-44a27a26e910c9fb27731bd2cb267262949ea2da.tar.gz |
MDEV-28416 Incorrect AUTO_INCREMENT may be issued when close to UINT64_MAX
ha_innobase::get_auto_increment(): In the overflow check, account
for 64-bit unsigned integer wrap-around.
Based on mysql/mysql-server@25ecfe7f49b5a649e96d462cb90602de9de3b919
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 1884250ee48..53d5a07b79f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -16970,8 +16970,8 @@ ha_innobase::get_auto_increment( (3) It is restricted only for insert operations. */ - if (increment > 1 && thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE - && autoinc < col_max_value) { + if (increment > 1 && increment <= ~autoinc && autoinc < col_max_value + && thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE) { ulonglong prev_auto_inc = autoinc; |