summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authormonty@donna.mysql.com <>2001-01-15 17:17:43 +0200
committermonty@donna.mysql.com <>2001-01-15 17:17:43 +0200
commit40494168addbbd1663ad6766429210b2811c0fcd (patch)
tree4264a6499afeab1b99e53f927059e5450643a435 /myisam
parenta7ab29a5392b6feeec5a4b909fef5791fb44d01a (diff)
downloadmariadb-git-40494168addbbd1663ad6766429210b2811c0fcd.tar.gz
Fixed test when exeeding file quota on write
Sanity checks when opening MyISAM files
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_check.c2
-rw-r--r--myisam/mi_open.c23
-rw-r--r--myisam/myisamchk.c11
3 files changed, 24 insertions, 12 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index b394fb25e97..67503bd4f6c 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -543,7 +543,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
if (next_page+info->s->blocksize > max_length)
goto err;
info->state->key_file_length=(max_length &
- ~ (my_off_t) (info->s->blocksize-1));
+ ~ (my_off_t) (info->s->blocksize-1));
}
if (!_mi_fetch_keypage(info,keyinfo,next_page,temp_buff,0))
{
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index 2eab33228dc..0280355ae72 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -185,6 +185,22 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
HA_ERR_CRASHED_ON_REPAIR : HA_ERR_CRASHED_ON_USAGE);
goto err;
}
+
+ /* sanity check */
+ if (share->base.keystart > 65535 || share->base.rec_reflength > 8)
+ {
+ my_errno=HA_ERR_CRASHED;
+ goto err;
+ }
+
+ if (share->base.max_key_length > MI_MAX_KEY_BUFF || keys > MI_MAX_KEY ||
+ key_parts >= MI_MAX_KEY * MI_MAX_KEY_SEG)
+ {
+ DBUG_PRINT("error",("Wrong key info: Max_key_length: %d keys: %d key_parts: %d", share->base.max_key_length, keys, key_parts));
+ my_errno=HA_ERR_UNSUPPORTED;
+ goto err;
+ }
+
/* Correct max_file_length based on length of sizeof_t */
max_data_file_length=
(share->options & (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) ?
@@ -220,13 +236,6 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share->base.max_data_file_length=(my_off_t) max_data_file_length;
share->base.max_key_file_length=(my_off_t) max_key_file_length;
- if (share->base.max_key_length > MI_MAX_KEY_BUFF || keys > MI_MAX_KEY ||
- key_parts >= MI_MAX_KEY * MI_MAX_KEY_SEG)
- {
- DBUG_PRINT("error",("Wrong key info: Max_key_length: %d keys: %d key_parts: %d", share->base.max_key_length, keys, key_parts));
- my_errno=HA_ERR_UNSUPPORTED;
- goto err;
- }
if (share->options & HA_OPTION_COMPRESS_RECORD)
share->base.max_key_length+=2; /* For safety */
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index 0e6f5927a3a..8e794b7e708 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -200,7 +200,7 @@ static struct option long_options[] =
static void print_version(void)
{
- printf("%s Ver 1.40 for %s at %s\n",my_progname,SYSTEM_TYPE,
+ printf("%s Ver 1.41 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
}
@@ -506,6 +506,8 @@ static int myisamchk(MI_CHECK *param, my_string filename)
param->error_printed=1;
switch (my_errno) {
case HA_ERR_CRASHED:
+ mi_check_print_error(param,"'%s' doesn't have a correct index definition. You need to recreate it before you can do a repair",filename);
+ break;
case HA_ERR_WRONG_TABLE_DEF:
mi_check_print_error(param,"'%s' is not a MyISAM-table",filename);
break;
@@ -1205,9 +1207,10 @@ static int mi_sort_records(MI_CHECK *param,
param->temp_filename);
goto err;
}
- if (filecopy(param,new_file,info->dfile,0L,share->pack.header_length,
- "datafile-header"))
- goto err;
+ if (share->pack.header_length)
+ if (filecopy(param,new_file,info->dfile,0L,share->pack.header_length,
+ "datafile-header"))
+ goto err;
info->rec_cache.file=new_file; /* Use this file for cacheing*/
lock_memory(param);