mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
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"
This commit is contained in:
parent
3c6f108540
commit
2e6a9886a9
3 changed files with 26 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue