diff options
author | unknown <mattiasj@mattiasj-laptop.(none)> | 2007-11-12 14:51:14 +0100 |
---|---|---|
committer | unknown <mattiasj@mattiasj-laptop.(none)> | 2007-11-12 14:51:14 +0100 |
commit | 85d1853e875a5cbde7da69b3899891077d44726a (patch) | |
tree | df6873dcf549d250475b9257be759acc86ae37b1 /sql/opt_range.cc | |
parent | 8d861f438369a63fd01fc88f86351288c8baed84 (diff) | |
download | mariadb-git-85d1853e875a5cbde7da69b3899891077d44726a.tar.gz |
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)
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 99c28be36b0..b89e8b3dcbb 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -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; /* |