diff --git a/src/obproxy/proxy/mysqllib/ob_2_0_protocol_utils.cpp b/src/obproxy/proxy/mysqllib/ob_2_0_protocol_utils.cpp index 8f8dd07f3be1546b44888158597abb21c1994666..64be6deab5771e8fd969f251409cc8aea44f505e 100644 --- a/src/obproxy/proxy/mysqllib/ob_2_0_protocol_utils.cpp +++ b/src/obproxy/proxy/mysqllib/ob_2_0_protocol_utils.cpp @@ -118,8 +118,8 @@ int ObProto20Utils::analyze_one_compressed_packet( int64_t block_len = reader.block_read_avail(); char *buf_start = reader.start(); + char mysql_hdr[MYSQL_COMPRESSED_OB20_HEALDER_LENGTH]; if (OB_UNLIKELY(block_len < MYSQL_COMPRESSED_OB20_HEALDER_LENGTH)) { - char mysql_hdr[MYSQL_COMPRESSED_OB20_HEALDER_LENGTH]; 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)) { ret = OB_ERR_UNEXPECTED; diff --git a/src/obproxy/proxy/mysqllib/ob_mysql_analyzer_utils.cpp b/src/obproxy/proxy/mysqllib/ob_mysql_analyzer_utils.cpp index 0502af7ef7b60adec10a92308bd9275ac1f86606..8653f70ef03966d07ac5934cd0ca6d4799caee70 100644 --- a/src/obproxy/proxy/mysqllib/ob_mysql_analyzer_utils.cpp +++ b/src/obproxy/proxy/mysqllib/ob_mysql_analyzer_utils.cpp @@ -41,8 +41,8 @@ int ObMysqlAnalyzerUtils::analyze_one_compressed_packet( int64_t block_len = reader.block_read_avail(); char *buf_start = reader.start(); + char mysql_hdr[MYSQL_COMPRESSED_HEALDER_LENGTH]; if (OB_UNLIKELY(block_len < MYSQL_COMPRESSED_HEALDER_LENGTH)) { - char mysql_hdr[MYSQL_COMPRESSED_HEALDER_LENGTH]; char *written_pos = reader.copy(mysql_hdr, MYSQL_COMPRESSED_HEALDER_LENGTH, 0); if (OB_UNLIKELY(written_pos != mysql_hdr + MYSQL_COMPRESSED_HEALDER_LENGTH)) { ret = OB_ERR_UNEXPECTED; diff --git a/src/obproxy/stat/ob_stat_processor.cpp b/src/obproxy/stat/ob_stat_processor.cpp index 87037aa8c89c3eef1e3bf4f01fc579aef111f1c7..da5da868334eeb58193dcc29a7b29c1efd55952e 100644 --- a/src/obproxy/stat/ob_stat_processor.cpp +++ b/src/obproxy/stat/ob_stat_processor.cpp @@ -359,7 +359,7 @@ int ObStatProcessor::register_raw_stat( ObRecData data_default; 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; LOG_WARN("invalid rsb or id", K(rsb), K(id), K(sync_type), K(ret)); } else { diff --git a/src/obproxy/utils/ob_proxy_blowfish.cpp b/src/obproxy/utils/ob_proxy_blowfish.cpp index 24a80018a7a3c0e81aae0704f64696f542579bd0..8c31ff787de2a90753ad3dea980f659007cf591b 100644 --- a/src/obproxy/utils/ob_proxy_blowfish.cpp +++ b/src/obproxy/utils/ob_proxy_blowfish.cpp @@ -184,9 +184,7 @@ int ObBlowFish::convert_large_str_to_hex(const char *str, const int64_t str_len, int tmp_value = 0; for(int64_t i = start_pos; out_idx >= padding_len; --out_idx) { if (4 == byte_pos) { - if (i < 0) { - tmp_value = 0; - } else if (i >= int_num) { + if (i >= int_num) { tmp_value = is_negative ? -1 : 0; } else { int32_t var2 = static_cast(mag[int_num - i - 1 + start_pos]);