[MDEV-26221] my_sys DYNAMIC_ARRAY and DYNAMIC_STRING inconsistancy Created: 2021-07-23  Updated: 2022-07-18  Resolved: 2021-10-19

Status: Closed
Project: MariaDB Server
Component/s: Server
Fix Version/s: 10.7.1

Type: Task Priority: Trivial
Reporter: Eric Herman Assignee: Vicențiu Ciorbaru
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
causes MDEV-29124 ASAN errors in st_select_lex::print /... Open

 Description   

Consider:

extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,   
                                   size_t init_alloc,size_t alloc_increment);

vs:

extern my_bool init_dynamic_array2(PSI_memory_key psi_key, DYNAMIC_ARRAY *array,
                                   uint element_size, void *init_buffer,        
                                   uint init_alloc, uint alloc_increment,       
                                   myf my_flags);

I expect the values of init_alloc and alloc_increment to be size_t for DYNAMIC_ARRAY just like they are for DYNAMIC_STRING.



 Comments   
Comment by Eric Herman [ 2021-07-23 ]

The underlying structs also reflect this same inconsistency:

typedef struct st_dynamic_array                                                 
{                                                                               
  uchar *buffer;                                                                
  uint elements,max_element;                                                    
  uint alloc_increment;                                                         
  uint size_of_element;                                                         
  PSI_memory_key m_psi_key;                                                     
  myf malloc_flags;                                                             
} DYNAMIC_ARRAY;                                                                
                                                                                                                                                                
typedef struct st_dynamic_string                                                
{                                                                               
  char *str;                                                                    
  size_t length,max_length,alloc_increment;                                     
} DYNAMIC_STRING;

Comment by Eric Herman [ 2021-09-05 ]

https://github.com/MariaDB/server/pull/1899

Comment by Vicențiu Ciorbaru [ 2021-10-19 ]

Fixed with https://github.com/MariaDB/server/commit/401ff6994d842a4072b7b155e5a958e178e6497a

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