diff options
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/mi_create.c | 13 | ||||
-rw-r--r-- | myisam/mi_dynrec.c | 4 | ||||
-rw-r--r-- | myisam/mi_locking.c | 9 | ||||
-rw-r--r-- | myisam/mi_open.c | 16 | ||||
-rw-r--r-- | myisam/mi_packrec.c | 3 | ||||
-rw-r--r-- | myisam/mi_update.c | 3 | ||||
-rw-r--r-- | myisam/mi_write.c | 2 | ||||
-rw-r--r-- | myisam/myisamdef.h | 1 |
8 files changed, 38 insertions, 13 deletions
diff --git a/myisam/mi_create.c b/myisam/mi_create.c index d99c74f6136..d46672444e0 100644 --- a/myisam/mi_create.c +++ b/myisam/mi_create.c @@ -815,18 +815,19 @@ uint mi_get_pointer_length(ulonglong file_length, uint def) if (file_length) /* If not default */ { #ifdef NOT_YET_READY_FOR_8_BYTE_POINTERS - if (file_length >= (longlong) 1 << 56) + if (file_length >= ULL(1) << 56) def=8; + else #endif - if (file_length >= (longlong) 1 << 48) + if (file_length >= ULL(1) << 48) def=7; - if (file_length >= (longlong) 1 << 40) + else if (file_length >= ULL(1) << 40) def=6; - else if (file_length >= (longlong) 1 << 32) + else if (file_length >= ULL(1) << 32) def=5; - else if (file_length >= (1L << 24)) + else if (file_length >= ULL(1) << 24) def=4; - else if (file_length >= (1L << 16)) + else if (file_length >= ULL(1) << 16) def=3; else def=2; diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c index 114bdadf4ef..11f51f08d23 100644 --- a/myisam/mi_dynrec.c +++ b/myisam/mi_dynrec.c @@ -80,7 +80,7 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record) #endif if (!(rec_buff=(byte*) my_alloca(reclength))) { - my_errno=ENOMEM; + my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */ return(-1); } reclength2= _mi_rec_pack(info,rec_buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER), @@ -114,7 +114,7 @@ int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record) #endif if (!(rec_buff=(byte*) my_alloca(reclength))) { - my_errno=ENOMEM; + my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */ return(-1); } reclength=_mi_rec_pack(info,rec_buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER), diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c index 96b9f525cd0..42c21b915a5 100644 --- a/myisam/mi_locking.c +++ b/myisam/mi_locking.c @@ -325,6 +325,15 @@ void mi_update_status(void* param) } } + +void mi_restore_status(void *param) +{ + MI_INFO *info= (MI_INFO*) param; + info->state= &info->s->state.state; + info->append_insert_at_end= 0; +} + + void mi_copy_status(void* to,void *from) { ((MI_INFO*) to)->state= &((MI_INFO*) from)->save_state; diff --git a/myisam/mi_open.c b/myisam/mi_open.c index b911826a976..db750e670ab 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -322,7 +322,13 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) for (j=0 ; j < share->keyinfo[i].keysegs; j++,pos++) { disk_pos=mi_keyseg_read(disk_pos, pos); - + if (pos->flag & HA_BLOB_PART && + ! (share->options & (HA_OPTION_COMPRESS_RECORD | + HA_OPTION_PACK_RECORD))) + { + my_errno= HA_ERR_CRASHED; + goto err; + } if (pos->type == HA_KEYTYPE_TEXT || pos->type == HA_KEYTYPE_VARTEXT1 || pos->type == HA_KEYTYPE_VARTEXT2) @@ -440,6 +446,13 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) offset+=share->rec[i].length; } share->rec[i].type=(int) FIELD_LAST; /* End marker */ + if (offset > share->base.reclength) + { + /* purecov: begin inspected */ + my_errno= HA_ERR_CRASHED; + goto err; + /* purecov: end */ + } if (! lock_error) { @@ -504,6 +517,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) share->lock.get_status=mi_get_status; share->lock.copy_status=mi_copy_status; share->lock.update_status=mi_update_status; + share->lock.restore_status= mi_restore_status; share->lock.check_status=mi_check_status; } } diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c index 37614cc1e1f..6df64ae2cd4 100644 --- a/myisam/mi_packrec.c +++ b/myisam/mi_packrec.c @@ -591,8 +591,7 @@ static void fill_quick_table(uint16 *table, uint bits, uint max_bits, static uint copy_decode_table(uint16 *to_pos, uint offset, uint16 *decode_table) { - uint prev_offset; - prev_offset= offset; + uint prev_offset= offset; DBUG_ENTER("copy_decode_table"); /* Descent on the left side. */ diff --git a/myisam/mi_update.c b/myisam/mi_update.c index b35c27d75ad..bea457d2e9a 100644 --- a/myisam/mi_update.c +++ b/myisam/mi_update.c @@ -196,7 +196,8 @@ err: save_errno=my_errno; if (changed) key_changed|= HA_STATE_CHANGED; - if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL) + if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_OUT_OF_MEM || + my_errno == HA_ERR_RECORD_FILE_FULL) { info->errkey= (int) i; flag=0; diff --git a/myisam/mi_write.c b/myisam/mi_write.c index a93ee42e2c0..cc17d4c6165 100644 --- a/myisam/mi_write.c +++ b/myisam/mi_write.c @@ -168,7 +168,7 @@ int mi_write(MI_INFO *info, byte *record) err: save_errno=my_errno; if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL || - my_errno == HA_ERR_NULL_IN_SPATIAL) + my_errno == HA_ERR_NULL_IN_SPATIAL || my_errno == HA_ERR_OUT_OF_MEM) { if (info->bulk_insert) { diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h index 3df55fc4780..0733073a7ea 100644 --- a/myisam/myisamdef.h +++ b/myisam/myisamdef.h @@ -731,6 +731,7 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b, my_bool null_are_equal); void mi_get_status(void* param, int concurrent_insert); void mi_update_status(void* param); +void mi_restore_status(void* param); void mi_copy_status(void* to,void *from); my_bool mi_check_status(void* param); void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows); |