summaryrefslogtreecommitdiff
path: root/storage/myisam/myisamchk.c
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-06-03 18:41:17 +0300
committerMonty <monty@mariadb.org>2020-06-14 19:39:42 +0300
commit96d7294586dbd80aa48902138e3e42aec8977d90 (patch)
tree39ac4f8c7be7f7d2f1cd1fbb5f198973556dcba4 /storage/myisam/myisamchk.c
parentdfb41fddf69ccbca89fd322901f2809bc3bcc0e9 (diff)
downloadmariadb-git-96d7294586dbd80aa48902138e3e42aec8977d90.tar.gz
Fixed access of undefined memory for compressed MyISAM and Aria tables
MDEV-22689 MSAN use-of-uninitialized-value in decode_bytes() This was not a user visible issue as the huffman code lookup tables would automatically ignore any of the unitialized bits Fixed by adding a end-zero byte to the bit-stream buffer. Other things: - Fixed a (for this case) wrong assert in strmov() for myisamchk and aria_chk by removing the strmov()
Diffstat (limited to 'storage/myisam/myisamchk.c')
-rw-r--r--storage/myisam/myisamchk.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index c4b274b3fe9..10d4987e1cb 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -1427,20 +1427,25 @@ static void descript(HA_CHECK *param, register MI_INFO *info, char * name)
else
type=(enum en_fieldtype) share->rec[field].type;
end=strmov(buff,field_pack[type]);
+ if (end != buff)
+ {
+ *(end++)=',';
+ *(end++)=' ';
+ }
if (share->options & HA_OPTION_COMPRESS_RECORD)
{
if (share->rec[field].pack_type & PACK_TYPE_SELECTED)
- end=strmov(end,", not_always");
+ end=strmov(end,"not_always, ");
if (share->rec[field].pack_type & PACK_TYPE_SPACE_FIELDS)
- end=strmov(end,", no empty");
+ end=strmov(end,"no empty, ");
if (share->rec[field].pack_type & PACK_TYPE_ZERO_FILL)
{
- sprintf(end,", zerofill(%d)",share->rec[field].space_length_bits);
+ sprintf(end,"zerofill(%d), ",share->rec[field].space_length_bits);
end=strend(end);
}
}
- if (buff[0] == ',')
- strmov(buff,buff+2);
+ if (end != buff)
+ end[-2]= 0; /* Remove ", " */
int10_to_str((long) share->rec[field].length,length,10);
null_bit[0]=null_pos[0]=0;
if (share->rec[field].null_bit)