提交 e0d68da6 编写于 作者: L lemon0910 提交者: guangshu.wgs

fix coverity bug

上级 db9b7c9a
...@@ -118,8 +118,8 @@ int ObProto20Utils::analyze_one_compressed_packet( ...@@ -118,8 +118,8 @@ int ObProto20Utils::analyze_one_compressed_packet(
int64_t block_len = reader.block_read_avail(); int64_t block_len = reader.block_read_avail();
char *buf_start = reader.start(); char *buf_start = reader.start();
if (OB_UNLIKELY(block_len < MYSQL_COMPRESSED_OB20_HEALDER_LENGTH)) {
char mysql_hdr[MYSQL_COMPRESSED_OB20_HEALDER_LENGTH]; char mysql_hdr[MYSQL_COMPRESSED_OB20_HEALDER_LENGTH];
if (OB_UNLIKELY(block_len < MYSQL_COMPRESSED_OB20_HEALDER_LENGTH)) {
char *written_pos = reader.copy(mysql_hdr, MYSQL_COMPRESSED_OB20_HEALDER_LENGTH, 0); char *written_pos = reader.copy(mysql_hdr, MYSQL_COMPRESSED_OB20_HEALDER_LENGTH, 0);
if (OB_UNLIKELY(written_pos != mysql_hdr + MYSQL_COMPRESSED_OB20_HEALDER_LENGTH)) { if (OB_UNLIKELY(written_pos != mysql_hdr + MYSQL_COMPRESSED_OB20_HEALDER_LENGTH)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
......
...@@ -41,8 +41,8 @@ int ObMysqlAnalyzerUtils::analyze_one_compressed_packet( ...@@ -41,8 +41,8 @@ int ObMysqlAnalyzerUtils::analyze_one_compressed_packet(
int64_t block_len = reader.block_read_avail(); int64_t block_len = reader.block_read_avail();
char *buf_start = reader.start(); char *buf_start = reader.start();
if (OB_UNLIKELY(block_len < MYSQL_COMPRESSED_HEALDER_LENGTH)) {
char mysql_hdr[MYSQL_COMPRESSED_HEALDER_LENGTH]; char mysql_hdr[MYSQL_COMPRESSED_HEALDER_LENGTH];
if (OB_UNLIKELY(block_len < MYSQL_COMPRESSED_HEALDER_LENGTH)) {
char *written_pos = reader.copy(mysql_hdr, MYSQL_COMPRESSED_HEALDER_LENGTH, 0); char *written_pos = reader.copy(mysql_hdr, MYSQL_COMPRESSED_HEALDER_LENGTH, 0);
if (OB_UNLIKELY(written_pos != mysql_hdr + MYSQL_COMPRESSED_HEALDER_LENGTH)) { if (OB_UNLIKELY(written_pos != mysql_hdr + MYSQL_COMPRESSED_HEALDER_LENGTH)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
......
...@@ -359,7 +359,7 @@ int ObStatProcessor::register_raw_stat( ...@@ -359,7 +359,7 @@ int ObStatProcessor::register_raw_stat(
ObRecData data_default; ObRecData data_default;
memset(&data_default, 0, sizeof(ObRecData)); memset(&data_default, 0, sizeof(ObRecData));
if (OB_UNLIKELY(!check_argument(rsb, id)) || OB_UNLIKELY(sync_type > SYNC_MAX)) { if (OB_UNLIKELY(!check_argument(rsb, id)) || OB_UNLIKELY(sync_type >= SYNC_MAX)) {
ret = OB_INVALID_ARGUMENT; ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid rsb or id", K(rsb), K(id), K(sync_type), K(ret)); LOG_WARN("invalid rsb or id", K(rsb), K(id), K(sync_type), K(ret));
} else { } else {
......
...@@ -184,9 +184,7 @@ int ObBlowFish::convert_large_str_to_hex(const char *str, const int64_t str_len, ...@@ -184,9 +184,7 @@ int ObBlowFish::convert_large_str_to_hex(const char *str, const int64_t str_len,
int tmp_value = 0; int tmp_value = 0;
for(int64_t i = start_pos; out_idx >= padding_len; --out_idx) { for(int64_t i = start_pos; out_idx >= padding_len; --out_idx) {
if (4 == byte_pos) { if (4 == byte_pos) {
if (i < 0) { if (i >= int_num) {
tmp_value = 0;
} else if (i >= int_num) {
tmp_value = is_negative ? -1 : 0; tmp_value = is_negative ? -1 : 0;
} else { } else {
int32_t var2 = static_cast<int32_t>(mag[int_num - i - 1 + start_pos]); int32_t var2 = static_cast<int32_t>(mag[int_num - i - 1 + start_pos]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册