Skip to content

Commit 3b26b93

Browse files
author
Arun Kuruvila
committed
Bug#26881508: MYSQL #1: DISABLE_ABORT_ON_ERROR IN
AUTH_COMMON.H Description:- Sever crashes due to a NULL pointer de-reference. Analysis:- Sever encounters a NUll pointer de-reference during "acl_load()". Fix:- A check is introduced to avoid the NULL pointer de-reference. This issue is already prevented in 8.0 through Bug#27225806 fix. Therefore, this patch is applicable only for 5.7.
1 parent 71189c7 commit 3b26b93

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

sql/auth/auth_common.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef AUTH_COMMON_INCLUDED
22
#define AUTH_COMMON_INCLUDED
33

4-
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
4+
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
55
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU General Public License as published by
@@ -560,6 +560,13 @@ class Acl_load_user_table_schema_factory
560560
table->field[Acl_load_user_table_old_schema::MYSQL_USER_FIELD_PASSWORD_56];
561561
return strncmp(password_field->field_name, "Password", 8) == 0;
562562
}
563+
564+
virtual bool user_table_schema_check(TABLE* table)
565+
{
566+
return table->s->fields >
567+
Acl_load_user_table_old_schema::MYSQL_USER_FIELD_PASSWORD_56;
568+
}
569+
563570
virtual ~Acl_load_user_table_schema_factory() {}
564571
};
565572

sql/auth/sql_auth_cache.cc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -1495,8 +1495,18 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
14951495
We need to check whether we are working with old database layout. This
14961496
might be the case for instance when we are running mysql_upgrade.
14971497
*/
1498-
table_schema= user_table_schema_factory.get_user_table_schema(table);
1499-
is_old_db_layout= user_table_schema_factory.is_old_user_table_schema(table);
1498+
if (user_table_schema_factory.user_table_schema_check(table))
1499+
{
1500+
table_schema= user_table_schema_factory.get_user_table_schema(table);
1501+
is_old_db_layout= user_table_schema_factory.is_old_user_table_schema(table);
1502+
}
1503+
else
1504+
{
1505+
sql_print_error("[FATAL] mysql.user table is damaged. "
1506+
"Please run mysql_upgrade.");
1507+
end_read_record(&read_record_info);
1508+
goto end;
1509+
}
15001510

15011511
allow_all_hosts=0;
15021512
int read_rec_errcode;

0 commit comments

Comments
 (0)