Commit 2e6a9886 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-30526 Assertion `rights == merged->cols' failed in update_role_columns

another case of the antipattern "iterate the HASH and delete
elements as we go"
parent 3c6f1085
......@@ -163,5 +163,18 @@ drop role student;
drop role admin;
drop database crm;
#
# MDEV-30526 Assertion `rights == merged->cols' failed in update_role_columns
#
create table t1 ( pk int, i int);
create role a;
grant select (i), update (pk) on t1 to a;
revoke update (pk) on t1 from a;
show grants for a;
Grants for a
GRANT USAGE ON *.* TO `a`
GRANT SELECT (`i`) ON `test`.`t1` TO `a`
drop role a;
drop table t1;
#
# End of 10.3 tests
#
......@@ -196,6 +196,17 @@ drop role student;
drop role admin;
drop database crm;
--echo #
--echo # MDEV-30526 Assertion `rights == merged->cols' failed in update_role_columns
--echo #
create table t1 ( pk int, i int);
create role a;
grant select (i), update (pk) on t1 to a;
revoke update (pk) on t1 from a;
show grants for a;
drop role a;
drop table t1;
--echo #
--echo # End of 10.3 tests
--echo #
......@@ -6550,6 +6550,7 @@ static int update_role_columns(GRANT_TABLE *merged,
}
}
restart:
for (uint i=0 ; i < mh->records ; i++)
{
GRANT_COLUMN *col = (GRANT_COLUMN *)my_hash_element(mh, i);
......@@ -6558,6 +6559,7 @@ static int update_role_columns(GRANT_TABLE *merged,
{
changed= 1;
my_hash_delete(mh, (uchar*)col);
goto restart;
}
}
DBUG_ASSERT(rights == merged->cols);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment