diff options
author | unknown <monty@donna.mysql.com> | 2001-01-15 17:17:43 +0200 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2001-01-15 17:17:43 +0200 |
commit | 4d37689abeeaacb662c31d58038d2386a5228f8f (patch) | |
tree | 4264a6499afeab1b99e53f927059e5450643a435 /myisam/mi_open.c | |
parent | 4e264107df5c286d0a06ff28699aec398e36e684 (diff) | |
download | mariadb-git-4d37689abeeaacb662c31d58038d2386a5228f8f.tar.gz |
Fixed test when exeeding file quota on write
Sanity checks when opening MyISAM files
Docs/manual.texi:
Added information about Borland c++
myisam/mi_check.c:
Cleanup
myisam/mi_open.c:
Added sanity checking
myisam/myisamchk.c:
Better error messages
mysys/my_chsize.c:
Cleanup
mysys/my_seek.c:
Changed debug message
mysys/my_write.c:
Fixed test when exeeding file quota
Diffstat (limited to 'myisam/mi_open.c')
-rw-r--r-- | myisam/mi_open.c | 23 |
1 files changed, 16 insertions, 7 deletions
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 */ |