[MDEV-30036] NULL pointer dereference in partition_info::set_partition_bitmaps_from_table Created: 2022-11-18  Updated: 2022-12-02  Resolved: 2022-12-02

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.3.5, 10.11.1
Fix Version/s: 10.3.38, 10.4.28, 10.5.19, 10.6.12, 10.7.8, 10.8.7, 10.9.5, 10.10.3

Type: Bug Priority: Major
Reporter: Yury Chaikou Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None


 Description   

sql/partition_info.cc

bool partition_info::set_partition_bitmaps_from_table(TABLE_LIST *table_list)
{
  List<String> *partition_names= table_list ?
                                   NULL : table_list->partition_names;
  return set_partition_bitmaps(partition_names);
}

If table_list is not NULL then we assign NULL to partition_names.
If table_list is NULL then we dereference NULL pointer in table_list->partition_names.

Looks like the order of the ? operator results should be reversed:

bool partition_info::set_partition_bitmaps_from_table(TABLE_LIST *table_list)
{
  List<String> *partition_names= table_list ?
                                   table_list->partition_names : NULL;
  return set_partition_bitmaps(partition_names);
}



 Comments   
Comment by Yury Chaikou [ 2022-11-18 ]

Introduced in 10.3.5 - https://github.com/MariaDB/server/commit/b4a2baffa82e5c07b96a1c752228560dcac1359b

Generated at Thu Feb 08 10:13:09 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.