1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-09 22:24:09 +03:00

Bug#31705 Partitions: crash if varchar length > 65530

Buffer overflow due to wrong key length in partitioning

Changed to the correct key_length function.


sql/opt_range.cc:
  Bug#31705 Partitions: crash if varchar length > 65530
  Problem: buffer overflow due to wrong key-length
  
  Fix: Using correct key_length function
mysql-test/r/partition_datatype.result:
  Bug#31705 Partitions: crash if varchar length > 65530
  New test-result case for testing all column types
  used in key-partitioning.
  
  (For verifying correct key-length use)
mysql-test/t/partition_datatype.test:
  Bug#31705 Partitions: crash if varchar length > 65530 
  New test case for testing all column types
  used in key-partitioning.
  
  (For verifying correct key-length used)
This commit is contained in:
unknown
2007-11-12 14:51:14 +01:00
parent 8d861f4383
commit 85d1853e87
3 changed files with 499 additions and 6 deletions

View File

@@ -3344,18 +3344,16 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar)
{
key_part->key= 0;
key_part->part= part;
key_part->length= (uint16) (*field)->pack_length_in_rec();
/*
psergey-todo: check yet again if this is correct for tricky field types,
e.g. see "Fix a fatal error in decimal key handling" in open_binary_frm()
*/
key_part->store_length= (uint16) (*field)->pack_length();
key_part->store_length= key_part->length= (uint16) (*field)->key_length();
if ((*field)->real_maybe_null())
key_part->store_length+= HA_KEY_NULL_LENGTH;
if ((*field)->type() == MYSQL_TYPE_BLOB ||
(*field)->real_type() == MYSQL_TYPE_VARCHAR)
key_part->store_length+= HA_KEY_BLOB_LENGTH;
DBUG_PRINT("info", ("part %u length %u store_length %u", part,
key_part->length, key_part->store_length));
key_part->field= (*field);
key_part->image_type = Field::itRAW;
/*