Commit aa2f88ba authored by Sergei Golubchik's avatar Sergei Golubchik

5.1 merge

parents 7e431dc3 c0065d15
...@@ -479,7 +479,7 @@ sub main { ...@@ -479,7 +479,7 @@ sub main {
} }
} }
if ( not defined @$completed ) { if ( not @$completed ) {
mtr_error("Test suite aborted"); mtr_error("Test suite aborted");
} }
......
create table t1 (a int) engine=myisam data directory='MYSQL_TMP_DIR';
insert t1 values (1);
repair table t1;
Table Op Msg_type Msg_text
test.t1 repair error Can't create new tempfile: 'MYSQL_TMP_DIR/t1.TMD'
test.t1 repair status Operation failed
drop table t1;
create table t2 (a int) engine=aria data directory='MYSQL_TMP_DIR';
insert t2 values (1);
repair table t2;
Table Op Msg_type Msg_text
test.t2 repair error Can't create new tempfile: 'MYSQL_TMP_DIR/t2.TMD'
test.t2 repair status Operation failed
drop table t2;
#
# MDEV-5543 MyISAM repair unsafe usage of TMD files
#
--source include/have_symlink.inc
--source include/not_windows.inc
--source include/have_maria.inc
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
eval create table t1 (a int) engine=myisam data directory='$MYSQL_TMP_DIR';
insert t1 values (1);
--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t1.TMD
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
repair table t1;
drop table t1;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
eval create table t2 (a int) engine=aria data directory='$MYSQL_TMP_DIR';
insert t2 values (1);
--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t2.TMD
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
repair table t2;
drop table t2;
--list_files $MYSQL_TMP_DIR foobar5543
--system rm $MYSQL_TMP_DIR/t1.TMD $MYSQL_TMP_DIR/t2.TMD
...@@ -176,7 +176,7 @@ my_MD5Final (unsigned char digest[16], my_MD5Context *ctx) ...@@ -176,7 +176,7 @@ my_MD5Final (unsigned char digest[16], my_MD5Context *ctx)
putu32(ctx->buf[1], digest + 4); putu32(ctx->buf[1], digest + 4);
putu32(ctx->buf[2], digest + 8); putu32(ctx->buf[2], digest + 8);
putu32(ctx->buf[3], digest + 12); putu32(ctx->buf[3], digest + 12);
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
} }
#ifndef ASM_MD5 #ifndef ASM_MD5
......
...@@ -7708,7 +7708,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs) ...@@ -7708,7 +7708,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
if (!String::needs_conversion(length, cs, field_charset, &dummy_offset)) if (!String::needs_conversion(length, cs, field_charset, &dummy_offset))
{ {
Field_blob::store_length(length); Field_blob::store_length(length);
bmove(ptr+packlength,(char*) &from,sizeof(char*)); bmove(ptr + packlength, &from, sizeof(char*));
return 0; return 0;
} }
if (tmpstr.copy(from, length, cs)) if (tmpstr.copy(from, length, cs))
...@@ -8363,7 +8363,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs) ...@@ -8363,7 +8363,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
value.copy(from, length, cs); value.copy(from, length, cs);
from= value.ptr(); from= value.ptr();
} }
bmove(ptr + packlength, (char*) &from, sizeof(char*)); bmove(ptr + packlength, &from, sizeof(char*));
} }
return 0; return 0;
......
/* Copyright (C) 2004-2008 MySQL AB & MySQL Finland AB & TCX DataKonsult AB /* Copyright (C) 2004-2008 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
Copyright (C) 2008-2009 Sun Microsystems, Inc. Copyright (C) 2008-2009 Sun Microsystems, Inc.
Copyright (c) 2009, 2014, SkySQL Ab.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -1521,7 +1522,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize) ...@@ -1521,7 +1522,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
param->db_name= table->s->db.str; param->db_name= table->s->db.str;
param->table_name= table->alias.c_ptr(); param->table_name= table->alias.c_ptr();
param->tmpfile_createflag= O_RDWR | O_TRUNC; param->tmpfile_createflag= O_RDWR | O_TRUNC | O_EXCL;
param->using_global_keycache= 1; param->using_global_keycache= 1;
param->thd= thd; param->thd= thd;
param->tmpdir= &mysql_tmpdir_list; param->tmpdir= &mysql_tmpdir_list;
......
...@@ -7172,7 +7172,7 @@ my_bool _ma_apply_undo_row_delete(MARIA_HA *info, LSN undo_lsn, ...@@ -7172,7 +7172,7 @@ my_bool _ma_apply_undo_row_delete(MARIA_HA *info, LSN undo_lsn,
memcpy(field_pos, field_length_data, size_length); memcpy(field_pos, field_length_data, size_length);
field_length_data+= size_length; field_length_data+= size_length;
memcpy(field_pos + size_length, &header, sizeof(&header)); memcpy(field_pos + size_length, &header, sizeof(header));
header+= blob_length; header+= blob_length;
*blob_lengths++= blob_length; *blob_lengths++= blob_length;
break; break;
......
...@@ -58,7 +58,7 @@ ha_checksum _ma_checksum(MARIA_HA *info, const uchar *record) ...@@ -58,7 +58,7 @@ ha_checksum _ma_checksum(MARIA_HA *info, const uchar *record)
length= _ma_calc_blob_length(blob_size_length, pos); length= _ma_calc_blob_length(blob_size_length, pos);
if (length) if (length)
{ {
memcpy((char*) &pos, pos + blob_size_length, sizeof(char*)); memcpy(&pos, pos + blob_size_length, sizeof(char*));
crc= my_checksum(crc, pos, length); crc= my_checksum(crc, pos, length);
} }
continue; continue;
......
...@@ -583,7 +583,7 @@ static int _ma_put_key_in_record(register MARIA_HA *info, uint keynr, ...@@ -583,7 +583,7 @@ static int _ma_put_key_in_record(register MARIA_HA *info, uint keynr,
goto err; goto err;
#endif #endif
memcpy(record+keyseg->start+keyseg->bit_start, memcpy(record+keyseg->start+keyseg->bit_start,
(char*) &blob_ptr,sizeof(char*)); &blob_ptr,sizeof(char*));
memcpy(blob_ptr,key,length); memcpy(blob_ptr,key,length);
blob_ptr+=length; blob_ptr+=length;
......
/* /*
Copyright (c) 2000, 2011, Oracle and/or its affiliates Copyright (c) 2000, 2011, Oracle and/or its affiliates
Copyright (c) 2009, 2014, SkySQL Ab.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -1143,7 +1144,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK &param, bool do_optimize) ...@@ -1143,7 +1144,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK &param, bool do_optimize)
param.db_name= table->s->db.str; param.db_name= table->s->db.str;
param.table_name= table->alias.c_ptr(); param.table_name= table->alias.c_ptr();
param.tmpfile_createflag = O_RDWR | O_TRUNC; param.tmpfile_createflag= O_RDWR | O_TRUNC | O_EXCL;
param.using_global_keycache = 1; param.using_global_keycache = 1;
param.thd= thd; param.thd= thd;
param.tmpdir= &mysql_tmpdir_list; param.tmpdir= &mysql_tmpdir_list;
......
...@@ -40,7 +40,7 @@ ha_checksum mi_checksum(MI_INFO *info, const uchar *buf) ...@@ -40,7 +40,7 @@ ha_checksum mi_checksum(MI_INFO *info, const uchar *buf)
length=_mi_calc_blob_length(column->length- length=_mi_calc_blob_length(column->length-
portable_sizeof_char_ptr, portable_sizeof_char_ptr,
buf); buf);
memcpy((char*) &pos, buf+column->length- portable_sizeof_char_ptr, memcpy(&pos, buf+column->length- portable_sizeof_char_ptr,
sizeof(char*)); sizeof(char*));
break; break;
} }
......
...@@ -419,7 +419,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, ...@@ -419,7 +419,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
goto err; goto err;
#endif #endif
memcpy(record+keyseg->start+keyseg->bit_start, memcpy(record+keyseg->start+keyseg->bit_start,
(char*) &blob_ptr,sizeof(char*)); &blob_ptr,sizeof(char*));
memcpy(blob_ptr,key,length); memcpy(blob_ptr,key,length);
blob_ptr+=length; blob_ptr+=length;
......
...@@ -937,7 +937,7 @@ xtPublic xtBool myxt_create_row_from_key(XTOpenTablePtr XT_UNUSED(ot), XTIndexPt ...@@ -937,7 +937,7 @@ xtPublic xtBool myxt_create_row_from_key(XTOpenTablePtr XT_UNUSED(ot), XTIndexPt
*/ */
byte *key_ptr = key; // Cannot take the address of a register variable! byte *key_ptr = key; // Cannot take the address of a register variable!
memcpy(record+keyseg->start+keyseg->bit_start, memcpy(record+keyseg->start+keyseg->bit_start,
(char*) &key_ptr,sizeof(char*)); &key_ptr,sizeof(char*));
my_store_blob_length(record+keyseg->start, my_store_blob_length(record+keyseg->start,
(uint) keyseg->bit_start,length); (uint) keyseg->bit_start,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