summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-05-13 23:08:29 +0300
committerunknown <monty@mysql.com>2005-05-13 23:08:29 +0300
commitcdd6bc9bfeb1a82e7c7cfd8880f8e014ca5d9ff8 (patch)
treeb6fa522b4fdc511f6bdce8096b9424cf6704e153 /myisam
parent7c441dd1157c8ad525babb3fbbd43daff86a50ec (diff)
downloadmariadb-git-cdd6bc9bfeb1a82e7c7cfd8880f8e014ca5d9ff8.tar.gz
Fixed wrong buffer usage for auto-increment key with blob part that caused CHECK TABLE to report that the table was wrong. (Bug #10045)
myisam/mi_key.c: Fixed wrong buffer usage for auto-increment key with blob part that caused CHECK TABLE to report that the table was wrong. (Bug #10045) mysql-test/r/auto_increment.result: New test case mysql-test/t/auto_increment.test: New test case
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_key.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/myisam/mi_key.c b/myisam/mi_key.c
index 1688ab74823..06571c570e1 100644
--- a/myisam/mi_key.c
+++ b/myisam/mi_key.c
@@ -255,8 +255,25 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
} /* _mi_pack_key */
- /* Put a key in record */
- /* Used when only-keyread is wanted */
+
+/*
+ Store found key in record
+
+ SYNOPSIS
+ _mi_put_key_in_record()
+ info MyISAM handler
+ keynr Key number that was used
+ record Store key here
+
+ Last read key is in info->lastkey
+
+ NOTES
+ Used when only-keyread is wanted
+
+ RETURN
+ 0 ok
+ 1 error
+*/
static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
byte *record)
@@ -267,14 +284,8 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
byte *blob_ptr;
DBUG_ENTER("_mi_put_key_in_record");
- if (info->s->base.blobs && info->s->keyinfo[keynr].flag & HA_VAR_LENGTH_KEY)
- {
- if (!(blob_ptr=
- mi_alloc_rec_buff(info, info->s->keyinfo[keynr].keylength,
- &info->rec_buff)))
- goto err;
- }
- key=(byte*) info->lastkey;
+ blob_ptr= info->lastkey2; /* Place to put blob parts */
+ key=(byte*) info->lastkey; /* KEy that was read */
key_end=key+info->lastkey_length;
for (keyseg=info->s->keyinfo[keynr].seg ; keyseg->type ;keyseg++)
{