Commit 7832f1bb authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-6314 - Compile/run MariaDB with ASan

Fixed some compilation errors/warnings with ASan.
parent 55b01023
...@@ -447,6 +447,10 @@ IF(NOT DISABLE_SHARED) ...@@ -447,6 +447,10 @@ IF(NOT DISABLE_SHARED)
SOVERSION "${SHARED_LIB_MAJOR_VERSION}") SOVERSION "${SHARED_LIB_MAJOR_VERSION}")
IF(LINK_FLAG_NO_UNDEFINED OR VERSION_SCRIPT_LINK_FLAGS) IF(LINK_FLAG_NO_UNDEFINED OR VERSION_SCRIPT_LINK_FLAGS)
GET_TARGET_PROPERTY(libmysql_link_flags libmysql 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 SET_TARGET_PROPERTIES(libmysql PROPERTIES LINK_FLAGS
"${libmysql_link_flags} ${LINK_FLAG_NO_UNDEFINED} ${VERSION_SCRIPT_LINK_FLAGS}") "${libmysql_link_flags} ${LINK_FLAG_NO_UNDEFINED} ${VERSION_SCRIPT_LINK_FLAGS}")
ENDIF() ENDIF()
......
...@@ -1610,7 +1610,7 @@ dynamic_new_column_store(DYNAMIC_COLUMN *str, ...@@ -1610,7 +1610,7 @@ dynamic_new_column_store(DYNAMIC_COLUMN *str,
my_bool new_str) my_bool new_str)
{ {
struct st_service_funcs *fmt= fmt_data + hdr->format; struct st_service_funcs *fmt= fmt_data + hdr->format;
void **columns_order; void **UNINIT_VAR(columns_order);
uchar *element; uchar *element;
uint i; uint i;
enum enum_dyncol_func_result rc= ER_DYNCOL_RESOURCE; enum enum_dyncol_func_result rc= ER_DYNCOL_RESOURCE;
......
...@@ -514,39 +514,42 @@ void Item_func_from_base64::fix_length_and_dec() ...@@ -514,39 +514,42 @@ void Item_func_from_base64::fix_length_and_dec()
String *Item_func_from_base64::val_str(String *str) String *Item_func_from_base64::val_str(String *str)
{ {
String *res= args[0]->val_str_ascii(str); String *res= args[0]->val_str_ascii(str);
bool too_long= false;
int length; int length;
const char *end_ptr; const char *end_ptr;
if (!res || if (!res)
res->length() > (uint) base64_decode_max_arg_length() || goto err;
(too_long=
if (res->length() > (uint) base64_decode_max_arg_length() ||
((uint) (length= base64_needed_decoded_length((int) res->length())) > ((uint) (length= base64_needed_decoded_length((int) res->length())) >
current_thd->variables.max_allowed_packet)) || current_thd->variables.max_allowed_packet))
tmp_value.alloc((uint) length) ||
(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, push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED, ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(), ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(),
current_thd->variables.max_allowed_packet); current_thd->variables.max_allowed_packet);
goto err;
} }
else if (res && length < 0)
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())
{ {
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
ER_BAD_BASE64_DATA, ER(ER_BAD_BASE64_DATA), ER_BAD_BASE64_DATA, ER(ER_BAD_BASE64_DATA),
end_ptr - res->ptr()); end_ptr - res->ptr());
goto err;
} }
return 0;
}
tmp_value.length((uint) length); tmp_value.length((uint) length);
null_value= 0; null_value= 0;
return &tmp_value; return &tmp_value;
err:
null_value= 1; // NULL input, too long input, OOM, or badly formed input
return 0;
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
......
...@@ -120,7 +120,7 @@ rpl_slave_state::check_duplicate_gtid(rpl_gtid *gtid, rpl_group_info *rgi) ...@@ -120,7 +120,7 @@ rpl_slave_state::check_duplicate_gtid(rpl_gtid *gtid, rpl_group_info *rgi)
uint32 seq_no= gtid->seq_no; uint32 seq_no= gtid->seq_no;
rpl_slave_state::element *elem; rpl_slave_state::element *elem;
int res; int res;
bool did_enter_cond; bool did_enter_cond= false;
PSI_stage_info old_stage; PSI_stage_info old_stage;
THD *thd; THD *thd;
Relay_log_info *rli= rgi->rli; Relay_log_info *rli= rgi->rli;
...@@ -138,7 +138,6 @@ rpl_slave_state::check_duplicate_gtid(rpl_gtid *gtid, rpl_group_info *rgi) ...@@ -138,7 +138,6 @@ rpl_slave_state::check_duplicate_gtid(rpl_gtid *gtid, rpl_group_info *rgi)
each lock release and re-take. each lock release and re-take.
*/ */
did_enter_cond= false;
for (;;) for (;;)
{ {
if (elem->highest_seq_no >= seq_no) if (elem->highest_seq_no >= seq_no)
......
...@@ -1550,6 +1550,7 @@ public: ...@@ -1550,6 +1550,7 @@ public:
uint key_parts= table->actual_n_key_parts(key_info); uint key_parts= table->actual_n_key_parts(key_info);
empty= TRUE; empty= TRUE;
prefixes= 0; prefixes= 0;
LINT_INIT(calc_state);
is_single_comp_pk= FALSE; is_single_comp_pk= FALSE;
uint pk= table->s->primary_key; uint pk= table->s->primary_key;
......
...@@ -267,7 +267,7 @@ void tc_add_table(THD *thd, TABLE *table) ...@@ -267,7 +267,7 @@ void tc_add_table(THD *thd, TABLE *table)
TABLE_SHARE *purge_share= 0; TABLE_SHARE *purge_share= 0;
TABLE_SHARE *share; TABLE_SHARE *share;
TABLE *entry; TABLE *entry;
ulonglong purge_time; ulonglong UNINIT_VAR(purge_time);
TDC_iterator tdc_it; TDC_iterator tdc_it;
tdc_it.init(); tdc_it.init();
......
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