Commit b3161bd9 authored by Alexander Barkov's avatar Alexander Barkov

A cleanup (to fix ASAN problem) for MDEV-19863 Add const to TYPELIB pointers

In this statement:

  (uint *) thd->alloc(sizeof(uint) * field->interval->count+1);

parentheses around the '+' operator were missing. So too few memory
was allocated, which caused ASAN builds to fail on these tests:

  innodb.innodb-ucs2
  parts.part_ctype_utf32
  main.mix2_myisam_ucs2
  main.case
  main.ctype_ucs
  main.ctype_utf16
  main.ctype_utf16_uca
  main.ctype_utf16le

Fixed to a correct version with parentheses:

  (uint *) thd->alloc(sizeof(uint) * (field->interval->count+1));
parent 4d6a9094
......@@ -731,16 +731,16 @@ static bool pack_header(THD *thd, uchar *forminfo,
filled with default values it is saved in save_interval
The HEX representation is created from this copy.
*/
uint count= field->interval->count;
field->save_interval= field->interval;
field->interval= tmpint= (TYPELIB*) thd->alloc(sizeof(TYPELIB));
*tmpint= *field->save_interval;
tmpint->type_names=
(const char **) thd->alloc(sizeof(char*) *
(field->interval->count+1));
tmpint->type_lengths=
(uint *) thd->alloc(sizeof(uint) * field->interval->count+1);
tmpint->type_names[field->interval->count]= 0;
tmpint->type_lengths[field->interval->count]= 0;
(const char **) thd->alloc(sizeof(char*) *
(count + 1));
tmpint->type_lengths= (uint *) thd->alloc(sizeof(uint) * (count + 1));
tmpint->type_names[count]= 0;
tmpint->type_lengths[count]= 0;
for (uint pos= 0; pos < field->interval->count; pos++)
{
......
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