From 55f1d464ab6e36e0abef0d031e79637c7c7375e5 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 22 Aug 2023 09:06:42 +0800 Subject: [PATCH] fix invalid cmp --- source/libs/stream/src/streamBackendRocksdb.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index 97e9154480..3cf1d34a7e 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -967,13 +967,8 @@ static rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const cha rocksdb_snapshot_t** snapshot, rocksdb_readoptions_t** readOpt); int defaultKeyComp(void* state, const char* aBuf, size_t aLen, const char* bBuf, size_t bLen) { - int ret = 0; - // qError("alen: %d, blen:%d", (int)aLen, (int)bLen); - if (aLen < bLen) { - ret = memcmp(aBuf, bBuf, aLen); - } else { - ret = memcmp(aBuf, bBuf, bLen); - } + int len = aLen < bLen ? aLen : bLen; + int ret = memcmp(aBuf, bBuf, len); if (ret == 0) { if (aLen < bLen) return -1;