提交 bf5d7312 编写于 作者: X xy0 提交者: LINGuanRen

whitescan safety hole: mainly uninitialized variables

上级 b9fc7921
......@@ -1938,7 +1938,7 @@ int ObIJsonBase::to_number(ObIAllocator *allocator, number::ObNumber &number) co
int ObIJsonBase::to_datetime(int64_t &value) const
{
INIT_SUCC(ret);
int64_t datetime;
int64_t datetime = 0;
switch (json_type()) {
case ObJsonNodeType::J_DATETIME:
......@@ -1987,7 +1987,7 @@ int ObIJsonBase::to_datetime(int64_t &value) const
int ObIJsonBase::to_date(int32_t &value) const
{
INIT_SUCC(ret);
int32_t date;
int32_t date = 0;
switch (json_type()) {
case ObJsonNodeType::J_DATETIME:
......@@ -2034,7 +2034,7 @@ int ObIJsonBase::to_date(int32_t &value) const
int ObIJsonBase::to_time(int64_t &value) const
{
INIT_SUCC(ret);
int64_t time;
int64_t time = 0;
switch (json_type()) {
case ObJsonNodeType::J_TIME: {
......@@ -2079,7 +2079,7 @@ int ObIJsonBase::to_time(int64_t &value) const
int ObIJsonBase::to_bit(uint64_t &value) const
{
INIT_SUCC(ret);
uint64_t bit;
uint64_t bit = 0;
const ObJsonNodeType j_type = json_type();
ObDTMode dt_mode = 0;
......@@ -2839,7 +2839,7 @@ int ObJsonBaseUtil::string_to_bit(ObString &str, uint64_t &value)
{
INIT_SUCC(ret);
uint64_t bit;
uint64_t bit = 0;
int32_t bit_len = 0;
if (OB_FAIL(ObJsonBaseUtil::get_bit_len(str, bit_len))) {
......
......@@ -3305,7 +3305,7 @@ int ObJsonBin::remove_v0(size_t index)
ObJsonNodeType node_type = this->json_type();
ObJBVerType ver_type = this->get_vertype();
// 1. move into element index, get used bytes
uint64_t used_bytes;
uint64_t used_bytes = 0;
if (OB_FAIL(this->element(index))) {
LOG_WARN("failed to get element ", K(index), K(ret));
} else {
......
......@@ -5067,7 +5067,7 @@ int ObNumber::mul_v3(const ObNumber& other, ObNumber& value, ObIAllocator& alloc
int offset = 0;
bool check_sum_len = true;
uint32_t tmp_res_digits[OB_CALC_BUFFER_SIZE];
uint32_t tmp_res_digits[OB_CALC_BUFFER_SIZE] = {0};
uint32_t* res_digits = NULL;
if (strict_mode) {
res_digits = tmp_res_digits;
......
......@@ -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));
......
......@@ -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;
......
......@@ -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;
......
......@@ -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))) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册