summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2014-06-10 22:20:33 +0400
committerSergey Vojtovich <svoj@mariadb.org>2014-06-10 22:20:33 +0400
commit7832f1bb62f8f657f064d6184e4aba4d568a77a6 (patch)
tree7809c95b6650c7dbd814b9736d3bce8176e3af86
parent55b010233a2d897ac8bc7aee0f136f2794814455 (diff)
downloadmariadb-git-7832f1bb62f8f657f064d6184e4aba4d568a77a6.tar.gz
MDEV-6314 - Compile/run MariaDB with ASan
Fixed some compilation errors/warnings with ASan.
-rw-r--r--libmysql/CMakeLists.txt4
-rw-r--r--mysys/ma_dyncol.c2
-rw-r--r--sql/item_strfunc.cc49
-rw-r--r--sql/rpl_gtid.cc3
-rw-r--r--sql/sql_statistics.cc1
-rw-r--r--sql/table_cache.cc2
6 files changed, 34 insertions, 27 deletions
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
index 6897031b1f9..3637c2f7eee 100644
--- a/libmysql/CMakeLists.txt
+++ b/libmysql/CMakeLists.txt
@@ -447,6 +447,10 @@ IF(NOT DISABLE_SHARED)
SOVERSION "${SHARED_LIB_MAJOR_VERSION}")
IF(LINK_FLAG_NO_UNDEFINED OR VERSION_SCRIPT_LINK_FLAGS)
GET_TARGET_PROPERTY(libmysql_link_flags libmysql LINK_FLAGS)
+ IF(NOT libmysql_link_flags)
+ # Avoid libmysql_link_flags-NOTFOUND
+ SET(libmysql_link_flags)
+ ENDIF()
SET_TARGET_PROPERTIES(libmysql PROPERTIES LINK_FLAGS
"${libmysql_link_flags} ${LINK_FLAG_NO_UNDEFINED} ${VERSION_SCRIPT_LINK_FLAGS}")
ENDIF()
diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c
index 3b5e05f1b01..c0508b97922 100644
--- a/mysys/ma_dyncol.c
+++ b/mysys/ma_dyncol.c
@@ -1610,7 +1610,7 @@ dynamic_new_column_store(DYNAMIC_COLUMN *str,
my_bool new_str)
{
struct st_service_funcs *fmt= fmt_data + hdr->format;
- void **columns_order;
+ void **UNINIT_VAR(columns_order);
uchar *element;
uint i;
enum enum_dyncol_func_result rc= ER_DYNCOL_RESOURCE;
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index ec6ab0f3040..79f4343ea70 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -514,39 +514,42 @@ void Item_func_from_base64::fix_length_and_dec()
String *Item_func_from_base64::val_str(String *str)
{
String *res= args[0]->val_str_ascii(str);
- bool too_long= false;
int length;
const char *end_ptr;
- if (!res ||
- res->length() > (uint) base64_decode_max_arg_length() ||
- (too_long=
- ((uint) (length= base64_needed_decoded_length((int) res->length())) >
- current_thd->variables.max_allowed_packet)) ||
- tmp_value.alloc((uint) length) ||
- (length= base64_decode(res->ptr(), (int) res->length(),
+ if (!res)
+ goto err;
+
+ if (res->length() > (uint) base64_decode_max_arg_length() ||
+ ((uint) (length= base64_needed_decoded_length((int) res->length())) >
+ current_thd->variables.max_allowed_packet))
+ {
+ push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WARN_ALLOWED_PACKET_OVERFLOWED,
+ ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(),
+ current_thd->variables.max_allowed_packet);
+ goto err;
+ }
+
+ if (tmp_value.alloc((uint) length))
+ goto err;
+
+ if ((length= base64_decode(res->ptr(), (int) res->length(),
(char *) tmp_value.ptr(), &end_ptr, 0)) < 0 ||
end_ptr < res->ptr() + res->length())
{
- null_value= 1; // NULL input, too long input, OOM, or badly formed input
- if (too_long)
- {
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_WARN_ALLOWED_PACKET_OVERFLOWED,
- ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(),
- current_thd->variables.max_allowed_packet);
- }
- else if (res && length < 0)
- {
- push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
- ER_BAD_BASE64_DATA, ER(ER_BAD_BASE64_DATA),
- end_ptr - res->ptr());
- }
- return 0;
+ push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_BAD_BASE64_DATA, ER(ER_BAD_BASE64_DATA),
+ end_ptr - res->ptr());
+ goto err;
}
+
tmp_value.length((uint) length);
null_value= 0;
return &tmp_value;
+err:
+ null_value= 1; // NULL input, too long input, OOM, or badly formed input
+ return 0;
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index 105bdad6f97..e480e01874b 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -120,7 +120,7 @@ rpl_slave_state::check_duplicate_gtid(rpl_gtid *gtid, rpl_group_info *rgi)
uint32 seq_no= gtid->seq_no;
rpl_slave_state::element *elem;
int res;
- bool did_enter_cond;
+ bool did_enter_cond= false;
PSI_stage_info old_stage;
THD *thd;
Relay_log_info *rli= rgi->rli;
@@ -138,7 +138,6 @@ rpl_slave_state::check_duplicate_gtid(rpl_gtid *gtid, rpl_group_info *rgi)
each lock release and re-take.
*/
- did_enter_cond= false;
for (;;)
{
if (elem->highest_seq_no >= seq_no)
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 67e7a9c304b..7773b648748 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -1550,6 +1550,7 @@ public:
uint key_parts= table->actual_n_key_parts(key_info);
empty= TRUE;
prefixes= 0;
+ LINT_INIT(calc_state);
is_single_comp_pk= FALSE;
uint pk= table->s->primary_key;
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index 8b768240b4f..097f37d26d8 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -267,7 +267,7 @@ void tc_add_table(THD *thd, TABLE *table)
TABLE_SHARE *purge_share= 0;
TABLE_SHARE *share;
TABLE *entry;
- ulonglong purge_time;
+ ulonglong UNINIT_VAR(purge_time);
TDC_iterator tdc_it;
tdc_it.init();