whitescan safety hole: mainly uninitialized variables

This commit is contained in:
xy0
2022-04-01 16:52:41 +08:00
committed by LINxiansheng
parent b9fc792163
commit bf5d73125b
7 changed files with 14 additions and 13 deletions

View File

@ -24,7 +24,7 @@ int ObExprInetCommon::str_to_ipv4(int len, const char *str, bool& is_ip_format_i
{
is_ip_format_invalid = false;
int ret = OB_SUCCESS;
//Shortest IPv4 address"x.x.x.x"length:7
//Shortest IPv4 address:"x.x.x.x",length:7
if (7 > len || INET_ADDRSTRLEN - 1 < len) {
is_ip_format_invalid = true;
LOG_WARN("ip format invalid, too short or too long", K(len));
@ -33,6 +33,7 @@ int ObExprInetCommon::str_to_ipv4(int len, const char *str, bool& is_ip_format_i
LOG_WARN("ip_str or ipv4addr is null", K(ret), K(str), K(ipv4addr));
} else {
unsigned char byte_addr[4];
memset(byte_addr,0,sizeof(byte_addr));
int dotcnt = 0, numcnt = 0;
int byte = 0;
char c;
@ -89,7 +90,7 @@ int ObExprInetCommon::str_to_ipv6(int len, const char *str, bool& is_ip_format_i
int ret = OB_SUCCESS;
is_ip_format_invalid = false;
//Ipv6 length of mysql support: 2~39
//Shortest IPv6 address"::"length:2
//Shortest IPv6 address:"::",length:2
if (2 > len || INET6_ADDRSTRLEN - 1 < len) {
is_ip_format_invalid = true;
LOG_WARN("ip format invalid, too short or too long", K(len));

View File

@ -83,7 +83,7 @@ int ObExprJsonContainsPath::eval_json_contains_path(const ObExpr &expr,
LOG_WARN("get_json_doc failed", K(ret));
} else {
// get one_or_all flag
bool one_flag;
bool one_flag = false;
ObDatum *json_datum = NULL;
ObExpr *json_arg = expr.args_[1];
ObObjType val_type = json_arg->datum_meta_.type_;
@ -175,7 +175,7 @@ int ObExprJsonContainsPath::calc_resultN(common::ObObj &result,
LOG_WARN("get_json_doc failed", K(ret));
} else {
// get one_or_all flag
bool one_flag;
bool one_flag = false;
ObObjType val_type = params[1].get_type();
if (val_type == ObNullType || params[1].is_null()) {
is_null_result = true;

View File

@ -954,7 +954,7 @@ int ObExprJsonValue::cast_to_year(ObIJsonBase *j_base, uint8_t &val)
int ObExprJsonValue::cast_to_float(ObIJsonBase *j_base, ObObjType dst_type, float &val)
{
INIT_SUCC(ret);
double tmp_val;
double tmp_val = 0;
if (OB_ISNULL(j_base)) {
ret = OB_ERR_NULL_VALUE;

View File

@ -659,7 +659,7 @@ int ObMacroBlockWriter::save_root_micro_block()
}
if (OB_SUCC(ret)) {
ObStoreRow row;
IndexMicroBlockDesc* task_top_block_descs;
IndexMicroBlockDesc* task_top_block_descs = NULL;
if (OB_FAIL(micro_reader.init(block_data, &index_column_map_))) {
STORAGE_LOG(WARN, "failed to init micro block reader", K(ret));
} else if (OB_FAIL(sstable_index_writer_->get_index_block_desc(task_top_block_descs))) {