fix invalid read

This commit is contained in:
yihaoDeng 2024-09-24 15:42:18 +08:00
parent f097de9fe0
commit 2099a45547
2 changed files with 10 additions and 4 deletions

View File

@ -487,7 +487,14 @@ int32_t transUtilSWhiteListToStr(SIpWhiteList* pWhiteList, char** ppBuf);
enum { REQ_STATUS_INIT = 0, REQ_STATUS_PROCESSING };
#if defined(WINDOWS) || defined(DARWIN)
#define BUFFER_LIMIT 1
#define STATE_BUFFER_LIMIT 1
#else
#define BUFFER_LIMIT 4
#define STATE_BUFFER_LIMIT 8
#endif
#define HEAP_MISS_HIT_LIMIT 100000
#define READ_TIMEOUT 100000

View File

@ -3251,11 +3251,10 @@ static int32_t getOrCreateHeap(SHashObj* pConnHeapCache, char* key, SHeap** pHea
static FORCE_INLINE int8_t shouldSWitchToOtherConn(int32_t reqNum, int32_t sentNum, int32_t stateNum) {
int32_t total = reqNum + sentNum;
if (total >= BUFFER_LIMIT) {
if (stateNum >= STATE_BUFFER_LIMIT) {
return 1;
}
if (stateNum >= BUFFER_LIMIT * 2) {
if (total >= BUFFER_LIMIT) {
return 1;
}