From 474ed9fdfc88d4cf781ad42f97207a25195619f1 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 22 Dec 2001 02:29:23 +0200 Subject: [PATCH 1/2] ha_innobase.cc: Make sure no memory overrun of key buffer in range estimation sql/ha_innobase.cc: Make sure no memory overrun of key buffer in range estimation --- sql/ha_innobase.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 50c2a2aef5c..dc030dde39a 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -2956,7 +2956,8 @@ ha_innobase::records_in_range( KEY* key; dict_index_t* index; mysql_byte* key_val_buff2 = (mysql_byte*) my_malloc( - table->reclength, + table->reclength + + table->max_key_length + 100, MYF(MY_WME)); dtuple_t* range_start; dtuple_t* range_end; From 1b9930b1a8664554175178994e2fd1bf922223e2 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 22 Dec 2001 11:18:22 +0200 Subject: [PATCH 2/2] ha_innobase.h: Lower max key len to 3500 bytes because a secondary index record must also contain the primary key value sql/ha_innobase.h: Lower max key len to 3500 bytes because a secondary index record must also contain the primary key value --- sql/ha_innobase.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sql/ha_innobase.h b/sql/ha_innobase.h index 83e43b1d662..84698a9114b 100644 --- a/sql/ha_innobase.h +++ b/sql/ha_innobase.h @@ -96,10 +96,12 @@ class ha_innobase: public handler uint max_record_length() const { return HA_MAX_REC_LENGTH; } uint max_keys() const { return MAX_KEY; } uint max_key_parts() const { return MAX_REF_PARTS; } - /* An InnoDB page must store >= 2 keys: - max key length is therefore set to 7000 - bytes */ - uint max_key_length() const { return 7000; } + /* An InnoDB page must store >= 2 keys; + a secondary key record must also contain the + primary key value: + max key length is therefore set to slightly + less than 1 / 4 of page size which is 16 kB */ + uint max_key_length() const { return 3500; } bool fast_key_read() { return 1;} key_map keys_to_use_for_scanning() { return ~(key_map) 0; } bool has_transactions() { return 1;}