Commit 00db3c39 authored by serg@serg.mysql.com's avatar serg@serg.mysql.com

fixed crash with blobs in compressed table

parent 45ed0a08
...@@ -920,7 +920,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) ...@@ -920,7 +920,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
goto err; goto err;
start_recpos=pos; start_recpos=pos;
splits++; splits++;
VOID(_mi_pack_get_block_info(info,&block_info, -1, start_recpos, NullS)); VOID(_mi_pack_get_block_info(info,&block_info, -1, start_recpos));
pos=block_info.filepos+block_info.rec_len; pos=block_info.filepos+block_info.rec_len;
if (block_info.rec_len < (uint) info->s->min_pack_length || if (block_info.rec_len < (uint) info->s->min_pack_length ||
block_info.rec_len > (uint) info->s->max_pack_length) block_info.rec_len > (uint) info->s->max_pack_length)
...@@ -2891,7 +2891,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) ...@@ -2891,7 +2891,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
DBUG_RETURN(1); /* Something wrong with data */ DBUG_RETURN(1); /* Something wrong with data */
} }
sort_param->start_recpos=sort_param->pos; sort_param->start_recpos=sort_param->pos;
if (_mi_pack_get_block_info(info,&block_info,-1,sort_param->pos, NullS)) if (_mi_pack_get_block_info(info,&block_info,-1,sort_param->pos))
DBUG_RETURN(-1); DBUG_RETURN(-1);
if (!block_info.rec_len && if (!block_info.rec_len &&
sort_param->pos + MEMMAP_EXTRA_MARGIN == sort_param->pos + MEMMAP_EXTRA_MARGIN ==
......
...@@ -416,8 +416,7 @@ int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, byte *buf) ...@@ -416,8 +416,7 @@ int _mi_read_pack_record(MI_INFO *info, my_off_t filepos, byte *buf)
DBUG_RETURN(-1); /* _search() didn't find record */ DBUG_RETURN(-1); /* _search() didn't find record */
file=info->dfile; file=info->dfile;
if (_mi_pack_get_block_info(info, &block_info, file, filepos, if (_mi_pack_get_block_info(info, &block_info, file, filepos))
info->rec_buff))
goto err; goto err;
if (my_read(file,(byte*) info->rec_buff + block_info.offset , if (my_read(file,(byte*) info->rec_buff + block_info.offset ,
block_info.rec_len - block_info.offset, MYF(MY_NABP))) block_info.rec_len - block_info.offset, MYF(MY_NABP)))
...@@ -963,11 +962,10 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf, ...@@ -963,11 +962,10 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf,
if (_mi_read_cache(&info->rec_cache,(byte*) block_info.header,filepos, if (_mi_read_cache(&info->rec_cache,(byte*) block_info.header,filepos,
share->pack.ref_length, skip_deleted_blocks)) share->pack.ref_length, skip_deleted_blocks))
goto err; goto err;
b_type=_mi_pack_get_block_info(info,&block_info,-1, filepos, NullS); b_type=_mi_pack_get_block_info(info,&block_info,-1, filepos);
} }
else else
b_type=_mi_pack_get_block_info(info,&block_info,info->dfile,filepos, b_type=_mi_pack_get_block_info(info,&block_info,info->dfile,filepos);
info->rec_buff);
if (b_type) if (b_type)
goto err; /* Error code is already set */ goto err; /* Error code is already set */
#ifndef DBUG_OFF #ifndef DBUG_OFF
...@@ -1007,7 +1005,7 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf, ...@@ -1007,7 +1005,7 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf,
/* Read and process header from a huff-record-file */ /* Read and process header from a huff-record-file */
uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BLOCK_INFO *info, File file, uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BLOCK_INFO *info, File file,
my_off_t filepos, char *rec_buff) my_off_t filepos)
{ {
uchar *header=info->header; uchar *header=info->header;
uint head_length,ref_length; uint head_length,ref_length;
...@@ -1067,7 +1065,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BLOCK_INFO *info, File file, ...@@ -1067,7 +1065,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BLOCK_INFO *info, File file,
if (file > 0) if (file > 0)
{ {
info->offset=min(info->rec_len, ref_length - head_length); info->offset=min(info->rec_len, ref_length - head_length);
memcpy(rec_buff, header+head_length, info->offset); memcpy(myisam->rec_buff, header+head_length, info->offset);
} }
return 0; return 0;
} }
......
...@@ -608,8 +608,7 @@ extern "C" { ...@@ -608,8 +608,7 @@ extern "C" {
extern uint _mi_get_block_info(MI_BLOCK_INFO *,File, my_off_t); extern uint _mi_get_block_info(MI_BLOCK_INFO *,File, my_off_t);
extern uint _mi_rec_pack(MI_INFO *info,byte *to,const byte *from); extern uint _mi_rec_pack(MI_INFO *info,byte *to,const byte *from);
extern uint _mi_pack_get_block_info(MI_INFO *mysql, MI_BLOCK_INFO *, File, extern uint _mi_pack_get_block_info(MI_INFO *, MI_BLOCK_INFO *, File, my_off_t);
my_off_t, char *rec_buf);
extern void _my_store_blob_length(byte *pos,uint pack_length,uint length); extern void _my_store_blob_length(byte *pos,uint pack_length,uint length);
extern void _myisam_log(enum myisam_log_commands command,MI_INFO *info, extern void _myisam_log(enum myisam_log_commands command,MI_INFO *info,
const byte *buffert,uint length); const byte *buffert,uint length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment